slitaz-boot-scripts view etc/init.d/rc.functions @ rev 121

Add active_pidfile in rc.functions
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Oct 31 11:05:55 2008 +0000 (2008-10-31)
parents 58cc6775e0f0
children 31520720987c
line source
1 # /etc/init.d/rc.functions: SliTaz boot scripts functions.
2 #
4 # Status functions.
5 status()
6 {
7 local CHECK=$?
8 echo -en "\\033[70G[ "
9 if [ $CHECK = 0 ]; then
10 echo -en "\\033[1;33mOK"
11 else
12 echo -en "\\033[1;31mFailed"
13 fi
14 echo -e "\\033[0;39m ]"
15 }
17 # Another way to sleep.
18 usleep_progress()
19 {
20 CHAR='='
21 for i in `seq 79-1`
22 do
23 echo -n "$CHAR"
24 usleep 28000
25 done
26 echo "$CHAR"
27 }
29 # Check daemon with pidfile: usage check_pidfile $PIDFILE $DAEMON
30 active_pidfile()
31 {
32 if grep -qs "Name:.$(basename $2)$" /proc/$(cat $1)/status ; then
33 return 0
34 else
35 rm -f $1
36 return 1
37 fi
38 }