forked from ports/contrib
54 lines
1.1 KiB
Bash
Executable File
54 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# /etc/rc.d/docker: start/stop docker daemon
|
|
#
|
|
|
|
SSD=/sbin/start-stop-daemon
|
|
PROG=/usr/bin/docker
|
|
PIDFILE=/var/run/docker.pid
|
|
LOGFILE=/var/log/docker.log
|
|
|
|
. /etc/docker.conf
|
|
|
|
case $1 in
|
|
start)
|
|
# Ensure ownership and permissiong of log file.
|
|
touch $LOGFILE
|
|
chgrp docker $LOGFILE
|
|
chown 640 $LOGFILE
|
|
|
|
# Ensure cgroups is properly mounted.
|
|
cgroupfs-mount
|
|
|
|
$SSD --start --background --make-pidfile --pidfile $PIDFILE --exec $PROG -- daemon $OPTS >> $LOGFILE 2>&1
|
|
;;
|
|
stop)
|
|
$SSD --stop --retry 10 --pidfile $PIDFILE
|
|
|
|
# Unmount cgroups is
|
|
cgroupfs-umount
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
sleep 2
|
|
$0 start
|
|
;;
|
|
reload)
|
|
$SSD --stop --pidfile $PIDFILE --signal HUP
|
|
;;
|
|
status)
|
|
$SSD --status --pidfile $PIDFILE
|
|
case $? in
|
|
0) echo "$(basename $PROG) is running with pid $(cat $PID)" ;;
|
|
1) echo "$(basename $PROG) is not running but the pid file $PID exists" ;;
|
|
3) echo "$(basename $PROG) is not running" ;;
|
|
4) echo "Unable to determine the program status" ;;
|
|
esac
|
|
;;
|
|
*)
|
|
echo "usage: $0 [start|stop|restart|reload|status]"
|
|
;;
|
|
esac
|
|
|
|
# End of file
|