SUMMARY: swatch startup in RC files

From: Gregory Coleman (
Date: Tue Feb 10 1998 - 19:29:47 CST

Once again, Sun Managers has proven its awesomeness. Original question is
at the end of this message. Much thanks to everybody who replied.
Answers varied; some were things that I had already tried (eg. just put it
in the background); others were general reference about start-up files.
The best answer for this situation in particular seems to be:

A) Run it in the background and redirect STDOUT to a file


B) Use NoHUP (to daemon-ize...)

I was particularly impressed by the resolution offered by Bill Walker
<> who had done the work to figure out how to handle
the multiple 'tail -f' processes that Swatch spawns. Maybe not 'pretty' by
his own standards, but still effectual...I think it really helped me.

---from Bill--->

   PID1=`/usr/bin/ps -e -u 1 | /usr/bin/grep swatch | grep
       -v $$ | /usr/bin/awk '{print $1}'`
       echo $PID1 | tr -cs "[:digit:]" "[\n*]" | sort > /tmp/kill-swatch
   TAIL=`sort /tmp/kill-swatch | tail -1`
   PID2=`/usr/bin/ps -ef |/usr/bin/grep $TAIL | grep -v
       grep | /usr/bin/awk '{print $2}'`
        echo $PID2 | tr -cs "[:digit:]" "[\n*]" >> /tmp/kill-swatch
   TAIL=`sort /tmp/kill-swatch | tail -1`
   PID3=`/usr/bin/ps -ef |/usr/bin/grep $TAIL | grep -v
        grep | /usr/bin/awk '{print $2}'`
        echo $PID3 | tr -cs "[:digit:]" "[\n*]" >> /tmp/kill-swatch
                sort -r /tmp/kill-swatch > /tmp/kill-swatch-sorted
                uniq /tmp/kill-swatch-sorted /tmp/kill-swatch-uniq
                for PID in `cat /tmp/kill-swatch-uniq`
                        /usr/bin/kill -9 ${PID} 1>/dev/null 2>&1
                rm /tmp/kill-swat*


Much thanks to everybody:
 Rahul Roy <>
Jim Harmon <>
Richard Bajusz <>
Bill Walker <>
 Paul Markham <>
Alessandro Forghieri <>
 Ronald Loftin <>
Jim Seavey <>
Karl Vogel <>
Mark Bergman <>

===Original question===>
We have a variety of Sun servers which monitor via Swatch, a Perl program,
which some of you may be familiar. Right now, I start it up manually
as a regular user. Now i am wondering if this could be started by an rc
file on boot, and then proceed as a detached process. The question is
thus, "what makes a daemon a daemon under solaris; and can it be done in
If anybody has done such a similar tweak, I would surely like to know

<----Gregory Coleman -- Library & Center for Knowledge Management -- UCSF---->

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:30 CDT