slitaz-base-files view rootfs/etc/init.d/rc.functions @ rev 144
rc.functions: use libtaz.sh for status
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue May 01 09:29:59 2012 +0200 (2012-05-01) |
parents | c2f69fa0c490 |
children | 78038351c7c8 |
line source
1 #!/bin/sh
2 # /etc/init.d/rc.functions: SliTaz boot scripts functions.
3 #
5 . /lib/libtaz.sh
7 # Check daemon with pidfile: usage check_pidfile $PIDFILE $DAEMON
8 active_pidfile()
9 {
10 if [ ! -e $1 ]; then
11 return 1
12 elif grep -qs "Name:.$(basename $2)$" \
13 /proc/$(sed 's/[^0-9]//g' < $1 | head -n 1)/status ; then
14 return 0
15 else
16 rm -f $1
17 return 2
18 fi
19 }