I'm running CentOS 5.5 and have created an init script. The start of the script contains:
# Source function library.
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
fi
The start bit works fine, but I'm having problems with the status and stop part:
status)
echo -n "Status of script: "
status "/bin/sh /path/to/script.sh"
RETVAL=$?
echo
;;
In PS AUX the command appears as "/bin/sh /path/to/script.sh" and I can see the PID. But when I run:
./my_init_script status
It says the script is not running. Should I be using the /bin/sh bit, or just the full script path, or just the script filename?
The stop part of the init script utilises "killproc". Again what command should I be using to successfully kill all occurrances of the script?