A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

February 18, 2011

Starting and stopping the script



i have this simple script.

set -e


case "$1" in
echo "Startup of testscript. Tid: `date`" >> /var/testofstartup
echo "Stop of testscript. Tid: `date`" >> /var/testofstartup
$0 stop
$0 start
echo "All is well"
echo "Usage: /etc/init.d/atd {start|stop|restart|force-reload|status}"
exit 1

exit 0

Now i copied this script into the /etc/init.d and chmod 755 to it.

Then i made the following links

ln -s /etc/init.d/testscript /etc/rc5.d/S22testscript
ln -s /etc/init.d/testscript /etc/rc0.d/K22testscript

After that i do the chkconfig --add testscript and chkconfig --level 5 on

Then now what happenning is that the script automatically start as Fedora 13 boots but don't stop and it shutdown (i see the script status in the /var/testforstartup as defined in the bash code)

I have googled around for this then i even try for stopping the script at shutdown using.

ln -s /etc/init.d/testscript /etc/rc6.d/K22testscript

but still noting happens.

I am really confused , already like shutdown and reboot my machine 50 times and this dont work

Please help.



Click Here!