Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
192 - 1
# -*-Shell-script-*-
2
#
3
# functions This file contains functions to be used by most or all
4
#       shell scripts in the /etc/init.d directory.
5
#
6
 
7
TEXTDOMAIN=initscripts
8
 
9
# Make sure umask is sane
10
umask 022
11
 
12
# Set up a default search path.
13
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
14
export PATH
15
 
16
if [ $PPID -ne 1 -a -z "$SYSTEMCTL_SKIP_REDIRECT" ] && \
17
        [ -d /run/systemd/system ] ; then
18
    case "$0" in
19
    /etc/init.d/*|/etc/rc.d/init.d/*)
20
        _use_systemctl=1
21
        ;;
22
    esac
23
fi
24
 
25
systemctl_redirect () {
26
    local s
27
    local prog=${1##*/}
28
    local command=$2
29
    local options=""
30
 
31
    case "$command" in
32
    start)
33
        s=$"Starting $prog (via systemctl): "
34
        ;;
35
    stop)
36
        s=$"Stopping $prog (via systemctl): "
37
        ;;
38
    reload|try-reload)
39
        s=$"Reloading $prog configuration (via systemctl): "
40
        ;;
41
    restart|try-restart|condrestart)
42
        s=$"Restarting $prog (via systemctl): "
43
        ;;
44
    esac
45
 
46
    if [ -n "$SYSTEMCTL_IGNORE_DEPENDENCIES" ] ; then
47
        options="--ignore-dependencies"
48
    fi
49
 
50
    if ! systemctl show "$prog.service" > /dev/null 2>&1 || \
51
            systemctl show -p LoadState "$prog.service" | grep -q 'not-found' ; then
52
        action $"Reloading systemd: " /bin/systemctl daemon-reload
53
    fi
54
 
55
    action "$s" /bin/systemctl $options $command "$prog.service"
56
}
57
 
58
# Get a sane screen width
59
[ -z "${COLUMNS:-}" ] && COLUMNS=80
60
 
61
# Read in our configuration
62
if [ -z "${BOOTUP:-}" ]; then
63
    if [ -f /etc/sysconfig/init ]; then
64
        . /etc/sysconfig/init
65
    else
66
        # verbose ->> very (very!) old bootup look (prior to RHL-6.0?)
67
        # color ->> default bootup look
68
        # other ->> default bootup look without ANSI colors or positioning
69
        BOOTUP=color
70
        # Column to start "[  OK  ]" label in:
71
        RES_COL=60
72
        # terminal sequence to move to that column:
73
        MOVE_TO_COL="echo -en \\033[${RES_COL}G"
74
        # Terminal sequence to set color to a 'success' (bright green):
75
        SETCOLOR_SUCCESS="echo -en \\033[1;32m"
76
        # Terminal sequence to set color to a 'failure' (bright red):
77
        SETCOLOR_FAILURE="echo -en \\033[1;31m"
78
        # Terminal sequence to set color to a 'warning' (bright yellow):
79
        SETCOLOR_WARNING="echo -en \\033[1;33m"
80
        # Terminal sequence to reset to the default color:
81
        SETCOLOR_NORMAL="echo -en \\033[0;39m"
82
 
83
        # Verbosity of logging:
84
        LOGLEVEL=1
85
    fi
86
 
87
    # NOTE: /dev/ttyS* is serial console. "not a tty" is such as
88
    # /dev/null associated when executed under systemd service units.
89
    if LANG=C tty | grep --quiet -e '\(/dev/ttyS\|not a tty\)'; then
90
        BOOTUP=serial
91
        MOVE_TO_COL=
92
        SETCOLOR_SUCCESS=
93
        SETCOLOR_FAILURE=
94
        SETCOLOR_WARNING=
95
        SETCOLOR_NORMAL=
96
    fi
97
fi
98
 
99
# Check if any of $pid (could be plural) are running
100
checkpid() {
101
    local i
102
 
103
    for i in $* ; do
104
        [ -d "/proc/$i" ] && return 0
105
    done
106
    return 1
107
}
108
 
109
__kill_pids_term_kill_checkpids() {
110
    local base_stime=$1
111
    shift 1
112
    local pid=
113
    local pids=$*
114
    local remaining=
115
    local stat=
116
    local stime=
117
 
118
    for pid in $pids ; do
119
        [ ! -e  "/proc/$pid" ] && continue
120
        read -r line < "/proc/$pid/stat" 2> /dev/null
121
 
122
        stat=($line)
123
        stime=${stat[21]}
124
 
125
        [ -n "$stime" ] && [ "$base_stime" -lt "$stime" ] && continue
126
        remaining+="$pid "
127
    done
128
 
129
    echo "$remaining"
130
    [ -n "$remaining" ] && return 1
131
 
132
    return 0
133
}
134
 
135
__kill_pids_term_kill() {
136
    local try=0
137
    local delay=3;
138
    local pid=
139
    local stat=
140
    local base_stime=
141
 
142
    # We can't initialize stat & base_stime on the same line where 'local'
143
    # keyword is, otherwise the sourcing of this file will fail for ksh...
144
    stat=($(< /proc/self/stat))
145
    base_stime=${stat[21]}
146
 
147
    if [ "$1" = "-d" ]; then
148
        delay=$2
149
        shift 2
150
    fi
151
 
152
    local kill_list=$*
153
 
154
    kill_list=$(__kill_pids_term_kill_checkpids $base_stime $kill_list)
155
 
156
    [ -z "$kill_list" ] && return 0
157
 
158
    kill -TERM $kill_list >/dev/null 2>&1
159
    sleep 0.1
160
 
161
    kill_list=$(__kill_pids_term_kill_checkpids $base_stime $kill_list)
162
    if [ -n "$kill_list" ] ; then
163
        while [ $try -lt $delay ] ; do
164
            sleep 1
165
            kill_list=$(__kill_pids_term_kill_checkpids $base_stime $kill_list)
166
            [ -z "$kill_list" ] && break
167
            let try+=1
168
        done
169
        if [ -n "$kill_list" ] ; then
170
            kill -KILL $kill_list >/dev/null 2>&1
171
            sleep 0.1
172
            kill_list=$(__kill_pids_term_kill_checkpids $base_stime $kill_list)
173
        fi
174
    fi
175
 
176
    [ -n "$kill_list" ] && return 1
177
    return 0
178
}
179
 
180
# __proc_pids {program} [pidfile]
181
# Set $pid to pids from /run* for {program}.  $pid should be declared
182
# local in the caller.
183
# Returns LSB exit code for the 'status' action.
184
__pids_var_run() {
185
    local base=${1##*/}
186
    local pid_file=${2:-/run/$base.pid}
187
    local pid_dir=$(/usr/bin/dirname $pid_file > /dev/null)
188
    local binary=$3
189
 
190
    [ -d "$pid_dir" ] && [ ! -r "$pid_dir" ] && return 4
191
 
192
    pid=
193
    if [ -f "$pid_file" ] ; then
194
            local line p
195
 
196
        [ ! -r "$pid_file" ] && return 4 # "user had insufficient privilege"
197
        while : ; do
198
            read line
199
            [ -z "$line" ] && break
200
            for p in $line ; do
201
                if [ -z "${p//[0-9]/}" ] && [ -d "/proc/$p" ] ; then
202
                    if [ -n "$binary" ] ; then
203
                        local b=$(readlink /proc/$p/exe | sed -e 's/\s*(deleted)$//')
204
                        [ "$b" != "$binary" ] && continue
205
                    fi
206
                    pid="$pid $p"
207
                fi
208
            done
209
        done < "$pid_file"
210
 
211
            if [ -n "$pid" ]; then
212
                    return 0
213
            fi
214
        return 1 # "Program is dead and /run pid file exists"
215
    fi
216
    return 3 # "Program is not running"
217
}
218
 
219
# Output PIDs of matching processes, found using pidof
220
__pids_pidof() {
221
    pidof -c -o $$ -o $PPID -o %PPID -x "$1" || \
222
        pidof -c -o $$ -o $PPID -o %PPID -x "${1##*/}"
223
}
224
 
225
 
226
# A function to start a program.
227
daemon() {
228
    # Test syntax.
229
    local gotbase= force= nicelevel corelimit
230
    local pid base= user= nice= bg= pid_file=
231
    local cgroup=
232
    nicelevel=0
233
    while [ "$1" != "${1##[-+]}" ]; do
234
        case $1 in
235
        '')
236
            echo $"$0: Usage: daemon [+/-nicelevel] {program}" "[arg1]..."
237
            return 1
238
            ;;
239
        --check)
240
            base=$2
241
            gotbase="yes"
242
            shift 2
243
            ;;
244
        --check=?*)
245
            base=${1#--check=}
246
            gotbase="yes"
247
            shift
248
            ;;
249
        --user)
250
            user=$2
251
            shift 2
252
            ;;
253
        --user=?*)
254
            user=${1#--user=}
255
            shift
256
            ;;
257
        --pidfile)
258
            pid_file=$2
259
            shift 2
260
            ;;
261
        --pidfile=?*)
262
            pid_file=${1#--pidfile=}
263
            shift
264
            ;;
265
        --force)
266
            force="force"
267
            shift
268
            ;;
269
        [-+][0-9]*)
270
            nice="nice -n $1"
271
            shift
272
            ;;
273
        *)
274
            echo $"$0: Usage: daemon [+/-nicelevel] {program}" "[arg1]..."
275
            return 1
276
            ;;
277
      esac
278
    done
279
 
280
    # Save basename.
281
    [ -z "$gotbase" ] && base=${1##*/}
282
 
283
    # See if it's already running. Look *only* at the pid file.
284
    __pids_var_run "$base" "$pid_file"
285
 
286
    [ -n "$pid" -a -z "$force" ] && return
287
 
288
    # make sure it doesn't core dump anywhere unless requested
289
    corelimit="ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0}"
290
 
291
    # if they set NICELEVEL in /etc/sysconfig/foo, honor it
292
    [ -n "${NICELEVEL:-}" ] && nice="nice -n $NICELEVEL"
293
 
294
    # if they set CGROUP_DAEMON in /etc/sysconfig/foo, honor it
295
    if [ -n "${CGROUP_DAEMON}" ]; then
296
        if [ ! -x /bin/cgexec ]; then
297
            echo -n "Cgroups not installed"; warning
298
            echo
299
        else
300
            cgroup="/bin/cgexec";
301
            for i in $CGROUP_DAEMON; do
302
                cgroup="$cgroup -g $i";
303
            done
304
        fi
305
    fi
306
 
307
    # Echo daemon
308
    [ "${BOOTUP:-}" = "verbose" -a -z "${LSB:-}" ] && echo -n " $base"
309
 
310
    # And start it up.
311
    if [ -z "$user" ]; then
312
       $cgroup $nice /bin/bash -c "$corelimit >/dev/null 2>&1 ; $*"
313
    else
314
       $cgroup $nice runuser -s /bin/bash $user -c "$corelimit >/dev/null 2>&1 ; $*"
315
    fi
316
 
317
    [ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup"
318
}
319
 
320
# A function to stop a program.
321
killproc() {
322
    local RC killlevel= base pid pid_file= delay try binary=
323
 
324
    RC=0; delay=3; try=0
325
    # Test syntax.
326
    if [ "$#" -eq 0 ]; then
327
        echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]"
328
        return 1
329
    fi
330
    if [ "$1" = "-p" ]; then
331
        pid_file=$2
332
        shift 2
333
    fi
334
    if [ "$1" = "-b" ]; then
335
        if [ -z $pid_file ]; then
336
            echo $"-b option can be used only with -p"
337
            echo $"Usage: killproc -p pidfile -b binary program"
338
            return 1
339
        fi
340
        binary=$2
341
        shift 2
342
    fi
343
    if [ "$1" = "-d" ]; then
344
        delay=$(echo $2 | awk -v RS=' ' -v IGNORECASE=1 '{if($1!~/^[0-9.]+[smhd]?$/) exit 1;d=$1~/s$|^[0-9.]*$/?1:$1~/m$/?60:$1~/h$/?60*60:$1~/d$/?24*60*60:-1;if(d==-1) exit 1;delay+=d*$1} END {printf("%d",delay+0.5)}')
345
        if [ "$?" -eq 1 ]; then
346
            echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]"
347
            return 1
348
        fi
349
        shift 2
350
    fi
351
 
352
 
353
    # check for second arg to be kill level
354
    [ -n "${2:-}" ] && killlevel=$2
355
 
356
    # Save basename.
357
    base=${1##*/}
358
 
359
    # Find pid.
360
    __pids_var_run "$1" "$pid_file" "$binary"
361
    RC=$?
362
    if [ -z "$pid" ]; then
363
        if [ -z "$pid_file" ]; then
364
            pid="$(__pids_pidof "$1")"
365
        else
366
            [ "$RC" = "4" ] && { failure $"$base shutdown" ; return $RC ;}
367
        fi
368
    fi
369
 
370
    # Kill it.
371
    if [ -n "$pid" ] ; then
372
        [ "$BOOTUP" = "verbose" -a -z "${LSB:-}" ] && echo -n "$base "
373
        if [ -z "$killlevel" ] ; then
374
            __kill_pids_term_kill -d $delay $pid
375
            RC=$?
376
            [ "$RC" -eq 0 ] && success $"$base shutdown" || failure $"$base shutdown"
377
        # use specified level only
378
        else
379
            if checkpid $pid; then
380
                kill $killlevel $pid >/dev/null 2>&1
381
                RC=$?
382
                [ "$RC" -eq 0 ] && success $"$base $killlevel" || failure $"$base $killlevel"
383
            elif [ -n "${LSB:-}" ]; then
384
                RC=7 # Program is not running
385
            fi
386
        fi
387
    else
388
        if [ -n "${LSB:-}" -a -n "$killlevel" ]; then
389
            RC=7 # Program is not running
390
        else
391
            failure $"$base shutdown"
392
            RC=0
393
        fi
394
    fi
395
 
396
    # Remove pid file if any.
397
    if [ -z "$killlevel" ]; then
398
        rm -f "${pid_file:-/run/$base.pid}"
399
    fi
400
    return $RC
401
}
402
 
403
# A function to find the pid of a program. Looks *only* at the pidfile
404
pidfileofproc() {
405
    local pid
406
 
407
    # Test syntax.
408
    if [ "$#" = 0 ] ; then
409
        echo $"Usage: pidfileofproc {program}"
410
        return 1
411
    fi
412
 
413
    __pids_var_run "$1"
414
    [ -n "$pid" ] && echo $pid
415
    return 0
416
}
417
 
418
# A function to find the pid of a program.
419
pidofproc() {
420
    local RC pid pid_file=
421
 
422
    # Test syntax.
423
    if [ "$#" = 0 ]; then
424
        echo $"Usage: pidofproc [-p pidfile] {program}"
425
        return 1
426
    fi
427
    if [ "$1" = "-p" ]; then
428
        pid_file=$2
429
        shift 2
430
    fi
431
    fail_code=3 # "Program is not running"
432
 
433
    # First try "/run/*.pid" files
434
    __pids_var_run "$1" "$pid_file"
435
    RC=$?
436
    if [ -n "$pid" ]; then
437
        echo $pid
438
        return 0
439
    fi
440
 
441
    [ -n "$pid_file" ] && return $RC
442
    __pids_pidof "$1" || return $RC
443
}
444
 
445
status() {
446
    local base pid lock_file= pid_file= binary=
447
 
448
    # Test syntax.
449
    if [ "$#" = 0 ] ; then
450
        echo $"Usage: status [-p pidfile] {program}"
451
        return 1
452
    fi
453
    if [ "$1" = "-p" ]; then
454
        pid_file=$2
455
        shift 2
456
    fi
457
    if [ "$1" = "-l" ]; then
458
        lock_file=$2
459
        shift 2
460
    fi
461
    if [ "$1" = "-b" ]; then
462
        if [ -z $pid_file ]; then
463
            echo $"-b option can be used only with -p"
464
            echo $"Usage: status -p pidfile -b binary program"
465
            return 1
466
        fi
467
        binary=$2
468
        shift 2
469
    fi
470
    base=${1##*/}
471
 
472
    if [ "$_use_systemctl" = "1" ]; then
473
        systemctl status ${0##*/}.service
474
        ret=$?
475
        # LSB daemons that dies abnormally in systemd looks alive in systemd's eyes due to RemainAfterExit=yes
476
        # lets adjust the reality a little bit
477
        if systemctl show -p ActiveState ${0##*/}.service | grep -q '=active$' && \
478
        systemctl show -p SubState ${0##*/}.service | grep -q '=exited$' ; then
479
            ret=3
480
        fi
481
        return $ret
482
    fi
483
 
484
    # First try "pidof"
485
    __pids_var_run "$1" "$pid_file" "$binary"
486
    RC=$?
487
    if [ -z "$pid_file" -a -z "$pid" ]; then
488
        pid="$(__pids_pidof "$1")"
489
    fi
490
    if [ -n "$pid" ]; then
491
        echo $"${base} (pid $pid) is running..."
492
        return 0
493
    fi
494
 
495
    case "$RC" in
496
    0)
497
        echo $"${base} (pid $pid) is running..."
498
        return 0
499
        ;;
500
    1)
501
        echo $"${base} dead but pid file exists"
502
        return 1
503
        ;;
504
    4)
505
        echo $"${base} status unknown due to insufficient privileges."
506
        return 4
507
        ;;
508
    esac
509
    if [ -z "${lock_file}" ]; then
510
        lock_file=${base}
511
    fi
512
    # See if /var/lock/subsys/${lock_file} exists
513
    if [ -f /var/lock/subsys/${lock_file} ]; then
514
        echo $"${base} dead but subsys locked"
515
        return 2
516
    fi
517
    echo $"${base} is stopped"
518
    return 3
519
}
520
 
521
echo_success() {
522
    [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
523
    echo -n "["
524
    [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
525
    echo -n $"  OK  "
526
    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
527
    echo -n "]"
528
    echo -ne "\r"
529
    return 0
530
}
531
 
532
echo_failure() {
533
    [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
534
    echo -n "["
535
    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
536
    echo -n $"FAILED"
537
    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
538
    echo -n "]"
539
    echo -ne "\r"
540
    return 1
541
}
542
 
543
echo_passed() {
544
    [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
545
    echo -n "["
546
    [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
547
    echo -n $"PASSED"
548
    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
549
    echo -n "]"
550
    echo -ne "\r"
551
    return 1
552
}
553
 
554
echo_warning() {
555
    [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
556
    echo -n "["
557
    [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
558
    echo -n $"WARNING"
559
    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
560
    echo -n "]"
561
    echo -ne "\r"
562
    return 1
563
}
564
 
565
# Inform the graphical boot of our current state
566
update_boot_stage() {
567
    if [ -x /bin/plymouth ]; then
568
        /bin/plymouth --update="$1"
569
    fi
570
    return 0
571
}
572
 
573
# Log that something succeeded
574
success() {
575
    [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_success
576
    return 0
577
}
578
 
579
# Log that something failed
580
failure() {
581
    local rc=$?
582
    [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_failure
583
    [ -x /bin/plymouth ] && /bin/plymouth --details
584
    return $rc
585
}
586
 
587
# Log that something passed, but may have had errors. Useful for fsck
588
passed() {
589
    local rc=$?
590
    [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_passed
591
    return $rc
592
}
593
 
594
# Log a warning
595
warning() {
596
    local rc=$?
597
    [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_warning
598
    return $rc
599
}
600
 
601
# Run some action. Log its output.
602
action() {
603
    local STRING rc
604
 
605
    STRING=$1
606
    echo -n "$STRING "
607
    shift
608
    "$@" && success $"$STRING" || failure $"$STRING"
609
    rc=$?
610
    echo
611
    return $rc
612
}
613
 
614
# returns OK if $1 contains $2
615
strstr() {
616
    [ "${1#*$2*}" = "$1" ] && return 1
617
    return 0
618
}
619
 
620
# Check whether file $1 is a backup or rpm-generated file and should be ignored
621
is_ignored_file() {
622
    case "$1" in
623
    *~ | *.bak | *.old | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
624
        return 0
625
        ;;
626
    esac
627
    return 1
628
}
629
 
630
# Convert the value ${1} of time unit ${2}-seconds into seconds:
631
convert2sec() {
632
  local retval=""
633
 
634
  case "${2}" in
635
    deci)   retval=$(awk "BEGIN {printf \"%.1f\", ${1} / 10}") ;;
636
    centi)  retval=$(awk "BEGIN {printf \"%.2f\", ${1} / 100}") ;;
637
    mili)   retval=$(awk "BEGIN {printf \"%.3f\", ${1} / 1000}") ;;
638
    micro)  retval=$(awk "BEGIN {printf \"%.6f\", ${1} / 1000000}") ;;
639
    nano)   retval=$(awk "BEGIN {printf \"%.9f\", ${1} / 1000000000}") ;;
640
    piko)   retval=$(awk "BEGIN {printf \"%.12f\", ${1} / 1000000000000}") ;;
641
  esac
642
 
643
  echo "${retval}"
644
}
645
 
646
# Evaluate shvar-style booleans
647
is_true() {
648
    case "$1" in
649
    [tT] | [yY] | [yY][eE][sS] | [oO][nN] | [tT][rR][uU][eE] | 1)
650
        return 0
651
        ;;
652
    esac
653
    return 1
654
}
655
 
656
# Evaluate shvar-style booleans
657
is_false() {
658
    case "$1" in
659
    [fF] | [nN] | [nN][oO] | [oO][fF][fF] | [fF][aA][lL][sS][eE] | 0)
660
        return 0
661
        ;;
662
    esac
663
    return 1
664
}
665
 
666
# Apply sysctl settings, including files in /etc/sysctl.d
667
apply_sysctl() {
668
    if [ -x /lib/systemd/systemd-sysctl ]; then
669
    /lib/systemd/systemd-sysctl
670
    else
671
        for file in /usr/lib/sysctl.d/*.conf ; do
672
            is_ignored_file "$file" && continue
673
            [ -f /run/sysctl.d/${file##*/} ] && continue
674
            [ -f /etc/sysctl.d/${file##*/} ] && continue
675
            test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1
676
        done
677
        for file in /run/sysctl.d/*.conf ; do
678
            is_ignored_file "$file" && continue
679
            [ -f /etc/sysctl.d/${file##*/} ] && continue
680
            test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1
681
        done
682
        for file in /etc/sysctl.d/*.conf ; do
683
            is_ignored_file "$file" && continue
684
            test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1
685
        done
686
        sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1
687
    fi
688
}
689
 
690
# A sed expression to filter out the files that is_ignored_file recognizes
691
__sed_discard_ignored_files='/\(~\|\.bak\|\.old\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'
692
 
693
if [ "$_use_systemctl" = "1" ]; then
694
        if  [ "x$1" = xstart -o \
695
              "x$1" = xstop -o \
696
              "x$1" = xrestart -o \
697
              "x$1" = xreload -o \
698
              "x$1" = xtry-restart -o \
699
              "x$1" = xforce-reload -o \
700
              "x$1" = xcondrestart ] ; then
701
 
702
        systemctl_redirect $0 $1
703
        exit $?
704
    fi
705
fi
706
 
707
strstr "$(cat /proc/cmdline)" "rc.debug" && set -x
708
return 0
709