> 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.

your script could read:

#!/bin/sh
# /etc/init.d/myscript
# references /etc/init.d/mystartupscript
#            /etc/init.d/myhaltscript
case "$1" in
  start|restart)
    su <user> -c '/etc/init.d/mystartupscript'
    ;;
  stop)
    su <user> -c '/etc/init.d/myhaltscript'
    ;;
  *)
    echo "Usage: myscript start|stop|restart"
    ;;
esac
# The End.

just put it in init.d and use update-rc.d to make it run automatically
greetz,

Joris


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to