Created
September 4, 2013 03:55
-
-
Save gabrielkfr/6432605 to your computer and use it in GitHub Desktop.
Script init de ejemplo para arranque de servicios.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Author: Gabriel K | |
# | |
# /etc/init.d/iperfd | |
# | |
### BEGIN INIT INFO | |
# Provides: iperf | |
# Required-Start: $network | |
# Required-Stop: $network | |
# Default-Start: 3 5 | |
# Default-Stop: 0 1 2 6 | |
# Short-Description: Iperf | |
# Description: Tool To Measure Network Performance. | |
### END INIT INFO | |
PROGRAM=/usr/bin/iperf | |
. /etc/rc.status | |
# The echo return value for success (defined in /etc/rc.config). | |
return=$rc_done | |
case "$1" in | |
start ) | |
echo -n "Starting service iperfd " | |
## | |
## Start daemon with startproc(8). If this fails | |
## the echo return value is set appropriate. | |
startproc -q $PROGRAM -s -D | |
rc_status -v | |
;; | |
stop ) | |
echo -n "Shutting down service iperfd " | |
## Stop daemon with killproc(8) and if this fails | |
## set echo the echo return value. | |
killproc -g $PROGRAM | |
rc_status -v | |
;; | |
try-restart ) | |
$0 status | |
if test $? = 0; then | |
$0 restart | |
else | |
rc_reset | |
fi | |
rc_status | |
;; | |
restart ) | |
$0 stop | |
$0 start | |
rc_status | |
;; | |
status ) | |
echo -n "Checking for service iperfd: " | |
## Check status with checkproc(8), if process is running | |
## checkproc will return with exit status 0. | |
checkproc $PROGRAM | |
rc_status -v | |
;; | |
* ) | |
echo "Usage: $0 {start|stop|restart|reload|force-reload|status|try-restart}" | |
exit 1 | |
;; | |
esac | |
rc_exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment