Results 1 to 4 of 4
I'm writing a little script using instructions from here to start and stop some bits and pieces when my system boots.
Code:
#! /bin/sh
# /etc/init.d/bensbits
#
# Carry out ...
- 04-19-2006 #1
Debian init.d startup & shutdown scripts
I'm writing a little script using instructions from here to start and stop some bits and pieces when my system boots.
My question is, how can I gracefully end the processes I started? I know I can use ps | aux to get the process numbers and then kill them, but how can I automate this?Code:#! /bin/sh # /etc/init.d/bensbits # # Carry out specific functions when asked to by the system case "$1" in start) echo "Starting PostgreSQL" su postgres /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >/tmp/logfile 2>&1 & exit echo "Starting PHP DNS Updater" php updateip.php >/dev/null & ;; stop) echo "Stopping script blah" echo "Could do more here" ;; *) echo "Usage: /etc/init.d/bensbits {start|stop}" exit 1 ;; esac exit 0Registered Linux user #389109
My Semi-Linux Blog
- 04-20-2006 #2
The easier thing might be to use the killall command. It kills processes by name rather that PID.
Stand up and be counted as a Linux user!
- 04-20-2006 #3
So if this is my process:
Would this work?Code:ps aux | grep php root 22308 0.0 0.5 8200 2332 ? S Apr19 0:00 php updateip.php
Code:killall "php updateip.php"
Registered Linux user #389109
My Semi-Linux Blog
- 04-20-2006 #4
Ooh, that's a tricky one, huh? I don't know if it would just kill the ipupdate thing, or all things related to php, or nothing at all. You might have to give the killall command a "live" test-run to see if it does the right thing.
Stand up and be counted as a Linux user!


Reply With Quote
