Summary: LSM volwatch

From: Randy Rodgers <rrodgers_at_fwi.com>
Date: Mon, 21 Apr 1997 13:15:39 -0500

Managers,

My original question was:

> I am considering having the script run "nohup volwatch root". Can anyone
> tell me if this will work?

This will work. The only drawback being that it creates a "nohup.out"
file.

I got a solution to this from Martyn Johnson maj_at_cl.cam.ac.uk which I have
included below:

============================================================================
=====

I'm not sure whether nohup will work. It should, but it has the annoying
side
effect of making a "hohup.out" file. I had the same problem and used a
locally-written program "setsid" which simply arranges to run a program as
a
session leader. Here is my volwatch script:

-------------------------cut---------------------------
PATH=/sbin:/usr/sbin:/usr/bin
export PATH

case "$1" in
'start')
        if [ -x /usr/sbin/volwatch -a \
             -x /usr/sbin/volnotify -a \
             -f /etc/vol/volboot ]; then
                setsid volwatch maintain &
                echo $! > /var/run/volwatch.pid
        fi
        ;;
'stop')
        if [ -s /var/run/volwatch.pid ]; then
                kill -TERM -`cat /var/run/volwatch.pid`
                rm /var/run/volwatch.pid
        fi
        ;;
*)
        echo "usage: $0 {start|stop}"
        ;;
esac
-------------------------cut---------------------------


and the "setsid" program that it uses is merely:


-------------------------cut---------------------------
#include <unistd.h>

main(argc, argv, envp)
char ** argv, ** envp;
{
        (void) setsid();
        execvp(argv[1], &argv[1], envp);
}
-------------------------cut---------------------------

Hope this helps.

-- 
Martyn Johnson      maj_at_cl.cam.ac.uk
University of Cambridge Computer Lab
Cambridge UK
[=================================
[ Randy Rodgers
[ rrodgers_at_fwi.com
[ System Administrator
[ Allen County/City of Fort Wayne
[ Information Systems (SCT)
[ (219)449-7660
[=================================
Received on Mon Apr 21 1997 - 20:34:27 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:36 NZDT