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

rc.functions: tiny edit
author Paul Issott <paul@slitaz.org>
date Thu Nov 04 09:51:36 2010 +0000 (2010-11-04)
parents 9d7ca10a4e62
children a0f7424e5486
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 return $CHECK
16 }
18 # Another way to sleep.
19 usleep_progress()
20 {
21 CHAR='='
22 for i in `seq 1 79`
23 do
24 echo -n "$CHAR"
25 usleep 18000
26 done
27 echo "$CHAR"
28 }
30 # Check daemon with pidfile: usage check_pidfile $PIDFILE $DAEMON
31 active_pidfile()
32 {
33 if [ ! -e $1 ]; then
34 return 1
35 elif grep -qs "Name:.$(basename $2)$" \
36 /proc/$(sed 's/[^0-9]//g' < $1 | head -n 1)/status ; then
37 return 0
38 else
39 rm -f $1
40 return 2
41 fi
42 }
44 # Set TZ
45 [ -s /etc/TZ ] && export TZ="$(cat /etc/TZ)"