OoO Pendant le journal télévisé du mardi 20 juillet 2010, vers 20:49, Javier Fernández-Sanguino Peña <[email protected]> disait :
> running_pid() {
> # Check if a given process pid's cmdline matches a given name
> pid=$1
> name=$2
> [ -z "$pid" ] && return 1
> [ ! -d /proc/$pid ] && return 1
> cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
> # Is this the expected child?
> [ "$cmd" != "$name" ] && return 1
> return 0
> }
> running_proc() {
> # Check if the process is running looking at /proc
> # (works for all users)
> pidfile=$1
> binname=$2
> # No pidfile, probably no daemon present
> [ ! -r "$pidfile" ] && return 1
> pid=`cat $pidfile`
> running_pid $pid $binname || return 1
> return 0
> }
Looking at other init.d scripts, I see they use pidofproc which is
defined in /lib/lsb/init-functions.
> start)
> check_root
> exitval=0
> log_daemon_msg "Starting $DESC "
> if running_proc $PIDDIR/$NAME.pid $DAEMON; then
> log_progress_msg "$NAME apparently already running"
> log_end_msg 0
> exit 0
> fi
Is it not the job of start-stop-daemon to tell that the process is
already running?
The remaining looks fine for me. Thanks for your patch.
--
printk("HPFS: Grrrr... Kernel memory corrupted ... going on, but
it'll crash very soon :-(\n");
2.4.3 linux/fs/hpfs/super.c
pgpPmtjPsDSpv.pgp
Description: PGP signature

