tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* Summary: LSM volwatch
@ 1997-04-21 18:15 Randy Rodgers
  0 siblings, 0 replies; only message in thread
From: Randy Rodgers @ 1997-04-21 18:15 UTC (permalink / raw)
  To: tru64-unix-managers

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
[=================================

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-04-21 18:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-04-21 18:15 Summary: LSM volwatch Randy Rodgers

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