Bypassing svscan

Daniel L. Miller dmiller at amfes.com
Fri May 18 00:11:28 BST 2007


Scott James Remnant wrote:
> On Thu, 2007-05-17 at 21:43 +0200, Daniel Exbrayat wrote:
>
>   
>> # svscan
>> #
>> # This service starts svscan DJBDNS utility which in turn starts the
>> # DJBDNS services belonging to /etc/svscan 
>> #
>> description     "service svscan daemon (part of DJBDNS tools)"
>>
>> start on network_is_up
>> stop  on shutdown
>>
>> pre-start script
>>    PATH="/usr/local/bin"
>> end script
>>
>>     
> This PATH won't affect anything, since the shell it is set in is lost at
> the end of the script.  You may have better luck with the following line
> in the config file:
>
> env PATH=/usr/local/bin
>
>   
>> # by the way, I am wondering how to show status for each "DJBDNS"
>> # services. Something like:
>>
>>     
> Is it possible to manually start each service?  If so, you could use
> instances to do this.
>
> Scott
>   
I posted something on this earlier.  I run the "services" directly, 
without supervise or svscan - because after all, svscan was also 
intended as an inittab replacement, and if we're using upstart it seems 
silly to continue trying to use multiple "master" daemons.  An example 
for starting dnscache:

# dnscache
#
# This task runs the dnscache server.

start on runlevel-1
start on runlevel-2
start on runlevel-3
start on runlevel-4
start on runlevel-5
start on runlevel-6

stop on shutdown

exec envdir /var/lib/dnscache/env envuidgid dnscache \
	softlimit -o250 -d "$DATALIMIT" /usr/bin/dnscache
respawn

## EOF



This works just dandy for executing dnscache.  The downside is I don't know how to perform the logging.  The manpage for djb's "supervise" says it creates a pipe between the primary service and the logger (typically the "multilog" program for djb stuff).  I've tried building a script that includes logging:

# dnscache
#
# This task runs the dnscache server.

start on runlevel-1
start on runlevel-2
start on runlevel-3
start on runlevel-4
start on runlevel-5
start on runlevel-6

stop on shutdown

script
    exec 2>&1
    exec envdir /var/lib/dnscache/env \
        envuidgid dnscache softlimit -o250 -d "$DATALIMIT" \
	/usr/bin/dnscache |  \
        setuidgid dnslog multilog t /var/log/djbdns/dnscache
end script
respawn

## EOF


And while dnscache runs, and multilog starts - it seems the pipe never 
gets created because multilog simply opens the logfile without writing 
anything.  Output of "ps ax | grep 'dns'":

13593 ?        Ss     0:00 /bin/sh -e -c exec 2>&1?exec envdir 
/var/lib/dnscache/env envuidgid dnscache softlimit -o250 -d "$DATALIMIT" 
/usr/bin/dnscache | setuidgid dnslog multilog t 
/var/log/djbdns/dnscache? /bin/sh
13594 ?        S      0:00 /usr/bin/dnscache
13595 ?        S      0:00 multilog t /var/log/djbdns/dnscache


Since I have no shell knowledge, I'm probably missing something basic in my "exec" line.  Any ideas?

-- 
Daniel




More information about the upstart-devel mailing list