Piet,
Very kind of you. Thanks.
Though, I have a few SysV scripts that I've created myself. Works fine.
For instance, I had to setup my STB fourport card with setserial
*before* the upsd starts. Etc.
I guess I'll have to create the same for this purpose. Thing is that I
have *two* instances of setiathome running. I guess I'll have to loop
around the 'kill `pidof setiathome`' command until there is no more. Any
tip for how to do that in an elegant and reliable way?
Regards
Gustav
Piet Barber wrote:
>
> Gustav Schaffter wrote:
>
> > Hi,
> >
> > In my rc.local I start two instances of setiathome.
> >
> > When I do a shutdown, I'd like those two processes to be automatically
> > killed *before* the shutdown sequence starts. (I'd also like to execute
> > a quick non related 'cleanup' sequence.)
> >
> > Is there any rc file where I could store some kill `pidof setiathome`
> > commands? A file where I could store any commands that should be
> > executed first, in a shutdown situation? Some kind of logically
> > 'inverted rc.local'?
> >
>
> rc.local gives me nightmares. I used to administer these old SunOS 4.1.4
> boxes (until entirely too recently), and there was no System V startup for
> that lame-o operating system. Everything had to be done in the /etc/rc.ip
> /etc/rc and /etc/rc.local
>
> The fun thing about these scripts is that if you screwed up line 2, then
> the program would exit at line 3. And any extra programs that were
> supposed to get started around line 10 wouldn't. So after a reboot, the
> webserver would mysteriously not start up, even though it was in the
> /etc/rc.local.
>
> And the most fun thing about that version of bourne shell is that there is
> no way to test the program without execution. So the only way to really
> test the script's sanity is to reboot. And your services may or may not
> start.
>
> rc.local is evil. Avoid it. Learn how to use System V startup scripts.
> It's painful, but worth it.
>
> in the /etc/rc.d/ directory, you will find bunches of bourne (again) shell
> programs.
>
> Each one of these is a neat tidy package to start and stop a service. The
> syntax is
>
> /etc/rc.d/init.d/progname start
> or
> /etc/rc.d/init.d/progname stop
>
> I don't have setiathome, but I wrote a feeble little start/stop script for
> you. No guarantees it'll work, though.
>
> After you get this, read 'man init'
>
> ------------------------------------------------------------------------
> #!/bin/sh
> #
> # Startup script for setiathome
> #
> # processname: setiathome
>
> # Source function library.
> . /etc/rc.d/init.d/functions
>
> # See how we were called.
> case "$1" in
> start)
> echo -n "Starting setiathome: "
> cd /home/pietb/setiathome
> ./setiathome &
> echo
> ;;
> stop)
> echo -n "Shutting down setiathome: "
> killproc setiathome
> echo
> ;;
> status)
> ps -ef |grep setiathome |grep -v 'grep'
> ;;
> restart)
> $0 stop
> $0 start
> ;;
> reload)
> echo -n "Reloading setiathome: "
> killproc setiathome -HUP
> echo
> ;;
> *)
> echo "Usage: $0 {start|stop|restart|reload|status}"
> exit 1
> esac
>
> exit 0
--
pgp = Pretty Good Privacy.
To get my public pgp key, send an e-mail to: [EMAIL PROTECTED]
Visit my web site at http://www.schaffter.com
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.