While I tend to agree with Mr Woods, here are some pointers to get you
started:
(I don't like Mandrake's init scripts. They are too specialized. I prefer
Caldera's.
Here are the basics for init scripts:
case "$1" in
start)
;;
stop)
;;
restart)
;;
esac
* The case and esac form a block, or a unit.
* Each of the start) stop) and restart) are options which can be handed to
the script at run-time (the first parameter on the command line)
* The ";;" lines signify the end of the current option block.
* Stick whatever commands you want to issue between the ) and ;; lines.
The command which will kill processes without grepping on ps is "killall"
It will kill any running process with that program name. eg. If I have 10
konqueror browsers open and I issue a command like this: "killall
konqueror" I would lose all 10 of my sessions.
HTH
"J. Craig Woods" <[EMAIL PROTECTED]>
At 01:56 PM 12/26/2001 -0800, you wrote:
>Hello all!
> I have a few programs that I've added to my server box running
mdk8.1
>and I'd like to create daemons and startup scripts for them in
>/etc/rc.d/init.d/ so that I can do the 'stop, start, restart, etc.'
>thing for them. I'm not a coder, though I'm trying to pick it up a
>little, and I've looked at my other files in that specific folder as
>well as searching the net for my answers, but to no avail. I want to
>know how to kill a thread without having to manually call 'top' and
>search for the pid then running kill on that pid. I would like to be
>able to do it the same way my other services run. I would also like to
>know how to make them start on boot-up. If someone would please point
>me in the correct direction or maybe give a brief tutorial on how these
>things work, I would be very grateful!
>
>TIA, Mike
Are you looking to write a script where you would have the ability to run
statements like "service some_program start" or some variation with "stop",
"status", etc.? Yes, the easy part is to know where to put it (/etc/init.d
and maybe /etc/rc5.d). Unfortunately the hard part is writing the script,
and there is no substitute for a good book on bash scripting. Plus you
might try looking at one of the other scripts for a running service, and
use this as a kind of template.
J. Craig Woods
UNIX/NT SA
-Art is the illusion of spontaneity-
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com