tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: "Randy Rodgers" <rrodgers () fwi ! com>
To: tru64-unix-managers
Subject: Summary: LSM volwatch
Date: Mon, 21 Apr 1997 18:15:39 +0000	[thread overview]
Message-ID: <96078611110561.tru64-unix-managers.marc@archive.invalid> (raw)

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@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@cl.cam.ac.uk
University of Cambridge Computer Lab
Cambridge UK

[=================================
[ Randy Rodgers
[ rrodgers@fwi.com
[ System Administrator
[ Allen County/City of Fort Wayne
[ Information Systems (SCT)
[ (219)449-7660
[=================================

                 reply	other threads:[~1997-04-21 18:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox