Thanks, that's what I needed. After consulting the policy manual, I decided the right thing was for the script to execute on entry into level S and exit for levels 0 and 6. The incantation for the script MSGateway is update-rc.d MSGateway start 90 S . stop 15 0 6 . reflecting my judgement I wanted the system basically up before the script ran on start up (priority 90, i.e., late) and I wanted the shutdown to happen relatively early (priority 15).
I provide that account for the benefit of those who follow, and in hope that someone will let me know if it was a mistake! By the way, I'm not sure what the success thing was in the stop case below; I got errors when I tested it and removed it from my script. On Thu, Jun 13, 2002 at 09:28:18PM -0500, Ron Johnson wrote: > On Thu, 2002-06-13 at 21:13, Ross Boylan wrote: > > What's the best way to run a script once on startup and again (well, a > > related script) on shutdown? I want to run the scripts as a user > > rather than root, which I believe is the standard init.d method. > > Since you (presumably) know about init.d & rc?.d, it's simple: > put a file in /etc/init.d just like always, but here's what it > will look like: > > #!/bin/sh > # dnetc - starts and stops dnetc, the distributed.net key cruncher > > # Source function library. > ####. /etc/rc.d/init.d/functions > > [ -x ~dnet/dnetc ] || exit 0 > > case "$1" in > start) > echo 'Starting distributed.net cracker' > su -c ~dnet/dnet.start.sh dnet > ;; > stop) > echo -n 'Stopping distributed.net cracker' > su -c ~dnet/dnet.shut.sh dnet > success > ;; > *) > echo "Usage: $0 {start|stop}" > exit 1 > esac > > exit 0 > > -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]