46
48
if [ $force = 1 ]; then
47
49
/sbin/start-stop-daemon --start --nicelevel $nice --quiet --startas $exec --pidfile /dev/null --oknodo -- $*
50
elif [ $pidfile ]; then
51
/sbin/start-stop-daemon --start --nicelevel $nice --quiet --exec $exec --oknodo --pidfile "$pidfile" -- $*
49
53
/sbin/start-stop-daemon --start --nicelevel $nice --quiet --exec $exec --oknodo -- $*
53
# The definition of "return" in the LSB documentation is ambiguous.
55
if [ -e /var/run/$1.pid ]; then
58
local pidfile line i pids= status
59
set -- `POSIXLY_CORRECT=1 getopt "p:" $*`
64
-p) pidfile=$2; shift 2;;
69
if [ -z "$pidfile" ]; then
70
pidfile=/var/run/$(basename "$1").pid
73
if [ -f "$pidfile" ]; then
74
read -d "" line < "$pidfile"
76
if [ -z "$(echo $p | sed 's/[0-9]//g')" -a -d "/proc/$i" ]; then
80
if [ -n "$pids" ]; then
84
return 2 # program is dead and /var/run pid file exists
86
elif [ -x /bin/pidof ]; then
87
/bin/pidof -o %PPID $1
89
[ "$status" = 1 ] && return 3 # program is not running
92
return 4 # program or service is unknown
63
96
# start-stop-daemon uses the same algorithm as "pidofproc" above.
98
local pidfile sig status
99
set -- `POSIXLY_CORRECT=1 getopt "p:" $*`
104
-p) pidfile=$2; shift 2;;
109
if [ ! $pidfile ]; then
110
pidfile=/var/run/$(basename "$1").pid
66
/sbin/start-stop-daemon --stop --pidfile /var/run/$1.pid --retry 5 --signal $2 --quiet --oknodo
114
sig=$(echo $2 | sed -e 's/^-\(.*\)/\1/')
115
sig=$(echo $sig | sed -e 's/^SIG\(.*\)/\1/')
116
/sbin/start-stop-daemon --stop --pidfile "$pidfile" --signal $sig --quiet
118
[ "$status" = 1 ] && return 3 # program is not running
68
/sbin/start-stop-daemon --stop --pidfile /var/run/$1.pid --retry 5 --retry 5 --quiet --oknodo
121
/sbin/start-stop-daemon --stop --pidfile "$pidfile" --retry 5 --quiet --oknodo
72
# Something fancier might be nice. But it meets the spec.
73
125
log_success_msg () {
76
129
log_failure_msg () {
131
if [ -x $TPUT ] && $TPUT hpa 60 >/dev/null 2>&1; then
134
echo " $RED*$NORMAL $@"
79
140
log_warning_msg () {
142
if [ -x $TPUT ] && $TPUT hpa 60 >/dev/null 2>&1; then
143
YELLOW=`$TPUT setaf 3`
145
echo " $YELLOW*$NORMAL $@"
152
# NON-LSB HELPER FUNCTIONS
154
# int get_lsb_header_val (char *scriptpathname, char *key)
155
get_lsb_header_val () {
156
if [ ! -f "$1" ] || [ -z "$2" ]; then
159
LSB_S="### BEGIN INIT INFO"
160
LSB_E="### END INIT INFO"
161
sed -n "/$LSB_S/,/$LSB_E/ s/# $2: \(.*\)/\1/p" $1
164
# int log_begin_message (char *message)
172
# int log_end_message (int exitstatus)
175
# If no arguments were passed, return
176
[ -z "$1" ] && return 1
178
# Only do the fancy stuff if we have an appropriate terminal
179
# and if /usr is already mounted
182
if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
184
if [ -n "$COLS" ]; then
185
COL=`$EXPR $COLS - 7`
194
if [ $1 -eq 0 ]; then
197
echo -e "$UP$START $RED*$NORMAL$END[${RED}fail${NORMAL}]"
200
if [ $1 -eq 0 ]; then