]> git.pld-linux.org Git - packages/docker.git/blobdiff - docker.init
renamed to docker
[packages/docker.git] / docker.init
diff --git a/docker.init b/docker.init
new file mode 100755 (executable)
index 0000000..d7de878
--- /dev/null
@@ -0,0 +1,100 @@
+#!/bin/sh
+#
+# Create lightweight, portable, self-sufficient containers.
+#
+# chkconfig:   345 20 80
+#
+# description: Docker is an open-source project to easily create lightweight, portable, \
+#  self-sufficient containers from any application. The same container that a \
+#  developer builds and tests on a laptop can run at scale, in production, on \
+#  VMs, bare metal, OpenStack clusters, public clouds and more. \
+# processname: docker
+# pidfile: /var/run/docker.pid
+#
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down "Docker"
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/docker ] && . /etc/sysconfig/docker
+
+pidfile="/var/run/docker.pid"
+
+start() {
+       # Check if the service is already running?
+       if [ -f /var/lock/subsys/docker ]; then
+               msg_already_running "Docker"
+               return
+       fi
+
+       msg_starting "Docker"
+       daemon --fork /usr/bin/docker -d
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/docker
+}
+
+stop() {
+       if [ ! -f /var/lock/subsys/docker ]; then
+               msg_not_running "Docker"
+               return
+       fi
+
+       # Stop daemons.
+       msg_stopping "Docker"
+       killproc --pidfile $pidfile docker -TERM
+       rm -f /var/lock/subsys/docker
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/docker ]; then
+               msg_not_running "Docker"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
+  status)
+       status --pidfile $pidfile docker docker
+       RETVAL=$?
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+       exit 3
+esac
+
+exit $RETVAL
This page took 0.076822 seconds and 4 git commands to generate.