slitaz-base-files view rootfs/etc/init.d/rc.functions @ rev 109

rc.shutdown --> rc.functions
author Christophe Lincoln <pankso@slitaz.org>
date Tue Mar 20 09:05:04 2012 +0100 (2012-03-20)
parents
children 32a9035b0181
line source
1 #!/bin/sh
2 # /etc/init.d/rc.functions: SliTaz boot scripts functions.
3 #
5 # Status functions.
6 status() {
7 echo -en "\\033[70G[ "
8 if [ $? = 0 ]; then
9 echo -en "\\033[1;32mOK"
10 else
11 echo -en "\\033[1;31mFailed"
12 fi
13 echo -e "\\033[0;39m ]"
14 }
16 # Check daemon with pidfile: usage check_pidfile $PIDFILE $DAEMON
17 active_pidfile()
18 {
19 if [ ! -e $1 ]; then
20 return 1
21 elif grep -qs "Name:.$(basename $2)$" \
22 /proc/$(sed 's/[^0-9]//g' < $1 | head -n 1)/status ; then
23 return 0
24 else
25 rm -f $1
26 return 2
27 fi
28 }