HUP signal handling in shell script
I want to add a HUP siganal handler to my rc script so that when kill -HUP is sent the program, it will restart itself. I want to use this funactionality in logadm.conf, so that /var/log/resmon/tmpwrite.log can rotate correctly (without this functionality, it will keep writing to /var/log/resmon/tmpwrite.log.1 instead of /var/log/resmon/tmpwrite.log).
#!/bin/sh
case "$1" in
'start')
pid=`ps -ef | grep "tmpmon.d" | egrep -v '(grep|remove)' | awk '{print $2}'`
if [ "$pid" != "" ]
then
kill $pid
fi
echo "Starting TMPMON..."
/home/alelai/tmpmon.d >> /var/log/resmon/tmpwrite.log &