4
# Copyright (C) 2012 Yahoo! Inc.
6
# Author: Joshua Harlow <harlowja@yahoo-inc.com>
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License version 3, as
10
# published by the Free Software Foundation.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
# See: http://wiki.debian.org/LSBInitScripts
22
# See: http://tiny.cc/czvbgw
23
# See: http://www.novell.com/coolsolutions/feature/15380.html
24
# Also based on dhcpd in RHEL (for comparison)
27
# Provides: cloud-final
28
# Required-Start: $all cloud-config
32
# Default-Start: 2 3 4 5
34
# Short-Description: The final cloud-init job
35
# Description: Start cloud-init and runs the final phase
36
# and any associated final modules as desired.
39
# Return values acc. to LSB for all commands but status:
41
# 1 - generic or unspecified error
42
# 2 - invalid or excess argument(s)
43
# 3 - unimplemented feature (e.g. "reload")
44
# 4 - user had insufficient privileges
45
# 5 - program is not installed
46
# 6 - program is not configured
47
# 7 - program is not running
48
# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
50
# Note that starting an already running service, stopping
51
# or restarting a not-running service as well as the restart
52
# with force-reload (in case signaling is not supported) are
53
# considered a success.
58
cloud_init="/usr/bin/cloud-init"
59
conf="/etc/cloud/cloud.cfg"
61
# If there exist sysconfig/default variable override files use it...
62
[ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init
63
[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init
66
[ -x $cloud_init ] || return 5
67
[ -f $conf ] || return 6
69
echo -n $"Starting $prog: "
70
$cloud_init $CLOUDINITARGS modules --mode final
76
echo -n $"Shutting down $prog: "
91
restart|try-restart|condrestart)
92
## Stop the service and regardless of whether it was
93
## running or not, start it again.
95
## Note: try-restart is now part of LSB (as of 1.9).
96
## RH has a similar command named condrestart.
101
# It does not support reload
105
echo -n $"Checking for service $prog:"
106
# Return value is slightly different for the status command:
107
# 0 - service up and running
108
# 1 - service dead, but /var/run/ pid file exists
109
# 2 - service dead, but /var/lock/ lock file exists
110
# 3 - service not running (unused)
111
# 4 - service status unknown :-(
112
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
116
echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload}"