wok-next annotate git/stuff/git-daemon @ rev 19159
/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu May 26 20:16:45 2016 +0300 (2016-05-26) |
parents | 5dfd3ce5f96b |
children | 20af6f0f7070 |
rev | line source |
---|---|
slaxemulator@11682 | 1 #!/bin/sh |
slaxemulator@11682 | 2 # /etc/init.d/git-daemon: Start, stop and restart git-daemon daemon on SliTaz, at boot |
slaxemulator@11682 | 3 # time or with the command line. |
slaxemulator@11682 | 4 # |
slaxemulator@11682 | 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS |
slaxemulator@11682 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf. |
slaxemulator@11682 | 7 # |
slaxemulator@11682 | 8 . /etc/init.d/rc.functions |
slaxemulator@11682 | 9 . /etc/daemons.conf |
slaxemulator@11682 | 10 |
slaxemulator@11682 | 11 NAME=git-daemon |
al@19159 | 12 DESC="$(_ '%s daemon' Git)" |
slaxemulator@11682 | 13 DAEMON=/usr/lib/git-core/git-daemon |
slaxemulator@11682 | 14 OPTIONS=$GIT_OPTIONS |
slaxemulator@11682 | 15 PIDFILE=/var/run/git-daemon.pid |
slaxemulator@11682 | 16 |
slaxemulator@11682 | 17 case "$1" in |
slaxemulator@11682 | 18 start) |
pascal@11686 | 19 if active_pidfile $PIDFILE git-daemon ; then |
al@19159 | 20 _ '%s is already running.' $NAME |
slaxemulator@11682 | 21 exit 1 |
slaxemulator@11682 | 22 fi |
al@19159 | 23 action 'Starting %s: %s...' "$DESC" $NAME |
slaxemulator@11682 | 24 $DAEMON --pid-file=$PIDFILE $OPTIONS |
slaxemulator@11682 | 25 status |
slaxemulator@11682 | 26 ;; |
slaxemulator@11682 | 27 stop) |
pascal@11686 | 28 if ! active_pidfile $PIDFILE git-daemon ; then |
al@19159 | 29 _ '%s is not running.' $NAME |
slaxemulator@11682 | 30 exit 1 |
slaxemulator@11682 | 31 fi |
al@19159 | 32 action 'Stopping %s: %s...' "$DESC" $NAME |
al@19159 | 33 kill $(cat $PIDFILE) |
slaxemulator@11682 | 34 status |
slaxemulator@11682 | 35 ;; |
slaxemulator@11682 | 36 restart) |
pascal@11686 | 37 if ! active_pidfile $PIDFILE git-daemon ; then |
al@19159 | 38 _ '%s is not running.' $NAME |
slaxemulator@11682 | 39 exit 1 |
slaxemulator@11682 | 40 fi |
al@19159 | 41 action 'Restarting %s: %s...' "$DESC" $NAME |
al@19159 | 42 kill $(cat $PIDFILE) |
slaxemulator@11682 | 43 sleep 2 |
slaxemulator@11682 | 44 $DAEMON $OPTIONS |
slaxemulator@11682 | 45 status |
slaxemulator@11682 | 46 ;; |
slaxemulator@11682 | 47 *) |
al@19159 | 48 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 49 newline |
slaxemulator@11682 | 50 exit 1 |
slaxemulator@11682 | 51 ;; |
slaxemulator@11682 | 52 esac |
slaxemulator@11682 | 53 |
slaxemulator@11682 | 54 exit 0 |