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

active_pidfile: avoid error msg
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 01 23:27:32 2008 +0000 (2008-12-01)
parents 03088acac44f
children 10b04a333b4d
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 [ ! -e $1 ]; then
33 return 1
34 elif grep -qs "Name:.$(basename $2)$" /proc/$(cat $1)/status ; then
35 return 0
36 else
37 rm -f $1
38 return 2
39 fi
40 }