USG 5.0 r2: can my program tell if it is in background/nohup'd?

The WITNESS bsa at ncoast.UUCP
Tue Aug 14 03:18:54 AEST 1984


Unless a drastic change took place in /bin/sh in USG5.0, "nohup" is a shell
script.  All it does is traps SIGHUP and "exec"s $*.  Try grabbing a copy of
/bin/nohup and modifying it.  If all else fails, ours is (yank it & modify):
-----------------------
trap "" 1 15
if test -t 2>&1  ; then
	echo "Sending output to 'nohup.out'"
	exec nice -5 $* >>nohup.out 2>&1
else
	exec nice -5 $* 2>&1
fi
-----------------------
Have fun!

--bsa
-- 
      Brandon Allbery: decvax!cwruecmp{!atvax}!bsa: R0176 at CSUOHIO.BITNET
					       ^ Note name change!
	 6504 Chestnut Road, Independence, OH 44131 <> (216) 524-1416

"The more they overthink the plumbin', the easier 'tis tae stop up the drain."



More information about the Comp.unix.wizards mailing list