SHA256
1
0
forked from pool/cloud-init
cloud-init/cloud-init.init

75 lines
1.8 KiB
Bash

#!/bin/sh
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Author: J. Daniel Schmidt <jdsn@suse.de>
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; version 2.1 of the License
#
# /etc/init.d/cloud-init
# and its symbolic link
# /usr/sbin/rccloud-init
#
#
### BEGIN INIT INFO
# Provides: cloud-init
# Required-Start: $network $syslog $remote_fs $named
# Should-Start: $time
# Required-Stop: $null
# Should-Stop: $null
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts the cloud-init process
# Description: Starts the cloud-init process that fetches
# the configuration for the system from a cloud controller.
### END INIT INFO
# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
CLOUDINIT_BIN=/usr/bin/cloud-init
test -x $CLOUDINIT_BIN || { echo "$CLOUDINIT_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check for existence of needed config file and read it
#CLOUDINIT_CONFIG=/etc/cloud/cloud.cfg
#test -r $CLOUDINIT_CONFIG || { echo "$CLOUDINIT_CONFIG not existing";
# if [ "$1" = "stop" ]; then exit 0;
# else exit 6; fi; }
. /etc/rc.status
rc_reset
case "$1" in
start)
echo -n "Starting cloud-init "
startproc $CLOUDINIT_BIN start
rc_status -v
;;
stop)
echo -n "Shutting down cloud-init "
killproc $CLOUDINIT_BIN
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
status)
echo -n "Checking for service cloud-init"
[ -e /root/.ssh/authorized_keys ]
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
rc_exit