]> git.pld-linux.org Git - packages/docker.git/blame_incremental - docker.init
up to 1.6.2 (2015-05-13)
[packages/docker.git] / docker.init
... / ...
CommitLineData
1#!/bin/sh
2#
3# Create lightweight, portable, self-sufficient containers.
4#
5# chkconfig: 345 20 80
6#
7# description: Docker is an open-source project to easily create lightweight, portable, \
8# self-sufficient containers from any application. The same container that a \
9# developer builds and tests on a laptop can run at scale, in production, on \
10# VMs, bare metal, OpenStack clusters, public clouds and more. \
11# processname: docker
12# pidfile: /var/run/docker.pid
13#
14
15# Source function library
16. /etc/rc.d/init.d/functions
17
18# Get network config
19. /etc/sysconfig/network
20
21# Check that networking is up.
22if is_yes "${NETWORKING}"; then
23 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
24 msg_network_down "Docker"
25 exit 1
26 fi
27else
28 exit 0
29fi
30
31# Get service config - may override defaults
32[ -f /etc/sysconfig/docker ] && . /etc/sysconfig/docker
33
34pidfile="/var/run/docker.pid"
35
36start() {
37 # Check if the service is already running?
38 if [ -f /var/lock/subsys/docker ]; then
39 msg_already_running "Docker"
40 return
41 fi
42
43 msg_starting "Docker"
44 daemon --fork /usr/bin/docker -d $OPTIONS
45 RETVAL=$?
46 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/docker
47}
48
49stop() {
50 if [ ! -f /var/lock/subsys/docker ]; then
51 msg_not_running "Docker"
52 return
53 fi
54
55 # Stop daemons.
56 msg_stopping "Docker"
57 killproc --pidfile $pidfile docker
58 rm -f /var/lock/subsys/docker
59}
60
61condrestart() {
62 if [ ! -f /var/lock/subsys/docker ]; then
63 msg_not_running "Docker"
64 RETVAL=$1
65 return
66 fi
67
68 stop
69 start
70}
71
72RETVAL=0
73# See how we were called.
74case "$1" in
75 start)
76 start
77 ;;
78 stop)
79 stop
80 ;;
81 restart)
82 stop
83 start
84 ;;
85 try-restart)
86 condrestart 0
87 ;;
88 force-reload)
89 condrestart 7
90 ;;
91 status)
92 status --pidfile $pidfile docker docker
93 RETVAL=$?
94 ;;
95 *)
96 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
97 exit 3
98esac
99
100exit $RETVAL
This page took 0.332857 seconds and 4 git commands to generate.