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


-- 
+---------------------------------------------------------+
| Ron Johnson, Jr.        Home: [EMAIL PROTECTED]     |
| Jefferson, LA  USA      http://ronandheather.dhs.org:81 |
|                                                         |
| "I have created a government of whirled peas..."        |
|   Maharishi Mahesh Yogi, 12-May-2002,                   |
!   CNN, Larry King Live                                  |
+---------------------------------------------------------+


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

Reply via email to