Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

96 lines (86 sloc) 1.718 kb
#!/bin/sh
#
# ec2-boot-init Bootstrapper for EC2
#
# chkconfig: 345 60 76
#
# description: Bootstraps EC2 instances in a way that enables you to
# customise a standard image into different configurations
# via structured user data
#
### BEGIN INIT INFO
# Provides: ec2-boot-init
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
prog="/usr/sbin/ec2-boot-init"
# Lockfile
if [ -d /var/lock/subsys ]; then
# RedHat/CentOS/etc who use subsys
lock="/var/lock/subsys/ec2-boot-init"
else
# The rest of them
lock="/var/lock/ec2-boot-init"
fi
# Source function library.
. /lib/lsb/init-functions
# Check that binary exists
if ! [ -f $prog ]
then
echo "ec2-boot-init binary not found"
exit 0
fi
# See how we were called.
case "$1" in
start)
echo -n "Starting ec2-boot-init: "
cp /etc/ec2-boot-init/motd.unprovisioned /etc/motd
${prog}
if [ $? = 0 ]; then
log_success_msg
touch $lock
exit 0
else
log_failure_msg
exit 1
fi
;;
stop)
log_success_msg
rm -f $lock
;;
restart)
$0 stop
sleep 2
$0 start
;;
condrestart)
if [ -f $lock ]; then
$0 stop
# avoid race
sleep 2
$0 start
fi
;;
status)
if [ -f ${lock} ]; then
echo "ec2-boot-init ran"
exit 0
else
echo "ec2-boot-init: service not started"
exit 1
fi
;;
force-reload)
echo "not implemented"
;;
*)
echo "Usage: ec2-boot-init {start|stop|restart|condrestart|status}"
exit 1
;;
esac
exit 0
Jump to Line
Something went wrong with that request. Please try again.