Oracle Solaris System Administration (MOSC)

MOSC Banner

HUP signal handling in shell script

edited Feb 23, 2012 4:01PM in Oracle Solaris System Administration (MOSC) 1 commentAnswered ✓
Hi folks,

    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 &

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center