Just wanted to know the correct process for adding a startup script to a CentOS 5 server.
I believe you create an +x file and stick it in /etc/init.d, but I’m not sure if you have to run chkconfig or some other command after that or not.
Also, would want to run this as a non root user.
Here is a basic template script I found. Would this work?
http://spiralbound.net/2007/07/23/example-linux-init-script/
#### SNIP ####
#! /bin/sh
# Basic support for IRIX style chkconfig
###
# chkconfig: 235 98 55
# description: Manages the services you are controlling with the chkconfig command
###
case "$1" in
start)
echo -n "Starting new-service"
#To run it as root:
/path/to/command/to/start/new-service
#Or to run it as some other user:
/bin/su - username -c /path/to/command/to/start/new-service
echo "."
;;
stop)
echo -n "Stopping new-service"
#To run it as root:
/path/to/command/to/stop/new-service
#Or to run it as some other user:
/bin/su - username -c /path/to/command/to/stop/new-service
echo "."
;;
*)
echo "Usage: /sbin/service new-service {start|stop}"
exit 1
esac
exit 0
#### /SNIP ####