"Fossies" - the Fresh Open Source Software Archive

Member "htpdate-1.3.4/scripts/htpdate.init" (18 Apr 2022, 1202 Bytes) of package /linux/www/htpdate-1.3.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "htpdate.init": 1.3.2_vs_1.3.3.

    1 #!/bin/sh
    2 
    3 ### BEGIN INIT INFO
    4 # Provides:          htpdate
    5 # Required-Start:    $network $remote_fs $syslog
    6 # Required-Stop:     $network $remote_fs $syslog
    7 # Default-Start:     2 3 4 5
    8 # Default-Stop:      0 1 6
    9 # Short-Description: htpdate time synchronization
   10 # Description:       htpdate is a time synchronization daemon
   11 ### END INIT INFO
   12 
   13 NAME="htpdate"
   14 DAEMON="/usr/sbin/${NAME}"
   15 PIDFILE="/var/run/${NAME}.pid"
   16 
   17 HTPDATE_ARGS="-s -t https://www.example.com"
   18 test -r "/etc/default/$NAME" && . "/etc/default/$NAME"
   19 
   20 start() {
   21     printf 'Starting %s: ' "$NAME"
   22     # shellcheck disable=SC2086 # we need the word splitting
   23     start-stop-daemon -S -q -x "$DAEMON" \
   24         -- -D -i "$PIDFILE" $HTPDATE_ARGS
   25     status=$?
   26     if [ "$status" -eq 0 ]; then
   27         echo "OK"
   28     else
   29         echo "FAIL"
   30     fi
   31     return "$status"
   32 }
   33 
   34 stop() {
   35     printf 'Stopping %s: ' "$NAME"
   36     start-stop-daemon -K -q -p "$PIDFILE"
   37     status=$?
   38     if [ "$status" -eq 0 ]; then
   39         rm -f "$PIDFILE"
   40         echo "OK"
   41     else
   42         echo "FAIL"
   43     fi
   44     return "$status"
   45 }
   46 
   47 restart() {
   48     stop
   49     start
   50 }
   51 
   52 case "$1" in
   53     start|stop|restart)
   54         "$1";;
   55     reload)
   56         # Restart, since there is no true "reload" feature.
   57         restart;;
   58     *)
   59         echo "Usage: $0 {start|stop|restart|reload}"
   60         exit 1
   61 esac