3
1
I am using Amazon Linux (RH-based distro) in AWS EC2.
I followed the structure of /usr/share/doc/initscripts-*/sysvinitfiles
to create an init script in /etc/init.d
.
/etc/init.d/do_something
#!/bin/sh
# chkconfig: 3 90 10
# description: Description of the script
start () {
echo -n "Doing something..." >> /opt/started.log
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/do_something
return $RETVAL
}
stop () {
echo -n "Stopping doing something..." >> /opt/stopped.log
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -rf /var/lock/subsys/do_something
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit $?
I can then register it with chkconfig, by doing chkconfig --add do_something
. This creates a S symlink in /etc/rc3.d
. However no K symlink is created. If I manually create the symlink and shutdown or restart the instance, the system script executes as expected.
What am I doing wrong and how can I get the K symlink to be generated (so that I don't have to manually create it)?