Links

   Quran Explorer - Interactive Audio Recitations & Translations

Wednesday, September 1, 2010

Fedora 10 - Startup Scripts

1. Startup Script
I have a fedora core box which needs to run different scripts on startup to provide services to other machines.

I found what appears to be the best solution for me, using ntsysv and init.d. Here's how it's done;

1.) make a new file in the /etc/init.d/ directory
2.) add your script to this file with the following lines at the top;
#!/bin/bash
# chkconfig: 345 85 15
# description: of your file

3.) enter this in the shell;
chkconfig --add startup_filename

4.) type ntsysv (instead of using setup>service>etc) - your startup script should now be in the list, checked and ready for action!

5. Confirm by
# service sesamedms-test start


NB: make sure the file is executable


Sample File

#!/bin/bash
# chkconfig: 345 85 15
# description: starts tomcat server

case "$1" in
start) /opt/tomcat/bin/startup.sh ;;
stop) /opt/tomcat/bin/shutdown.sh ;;
restart) /bin/sh $0 stop
/bin/sh $0 start ;;
*) echo "Usage: $0 {start|stop}"
exit 1 ;;
esac

No comments:

Post a Comment

Feel free to leave a comment