summaryrefslogtreecommitdiff
path: root/docker/docker.rc
blob: ccb56bdf85f4b216d9aecdbb287ac336a74777ba (plain)
    1 #!/bin/sh
    2 #
    3 # /etc/rc.d/docker: start/stop docker daemon
    4 #
    5 
    6 SSD=/sbin/start-stop-daemon
    7 PROG=/usr/bin/dockerd
    8 PID=/var/run/docker.pid
    9 CONF=/etc/docker.conf
   10 LOG=/var/log/docker.log
   11 
   12 if [ -f $CONF ]; then
   13     . $CONF
   14 else
   15     if [ -z $OPTS ]; then
   16         OPTS="-p $PID -G docker"
   17     fi
   18 fi
   19 
   20 case $1 in
   21   start)
   22     if [ ! -f $LOG ]; then
   23         touch $LOG
   24         chgrp docker $LOG
   25         chmod 640 $LOG
   26     fi
   27 
   28     /usr/bin/cgroupfs-mount
   29 
   30     $SSD --start --pidfile $PID --background --exec $PROG -- $OPTS >> $LOG 2>&1
   31     ;;
   32   stop)
   33     $SSD --stop --retry 10 --pidfile $PID
   34     ;;
   35   restart)
   36     $0 stop
   37     $0 start
   38     ;;
   39   status)
   40     $SSD --status --pidfile $PID
   41     case $? in
   42       0) echo "$PROG is running with pid $(cat $PID)" ;;
   43       1) echo "$PROG is not running but the pid file $PID exists" ;;
   44       3) echo "$PROG is not running" ;;
   45       4) echo "Unable to determine the program status" ;;
   46     esac
   47     ;;
   48   *)
   49     echo "usage: $0 [start|stop|restart|status]"
   50     ;;
   51 esac
   52 
   53 # End of file

Generated by cgit