281cf3654d
new package OBS-URL: https://build.opensuse.org/request/show/114068 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/autossh?expand=0&rev=1
96 lines
2.2 KiB
Bash
96 lines
2.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# SUSE system startup script for autossh
|
|
#
|
|
# Author: Plamen Kolev <multyrealm@gmail.com>
|
|
#
|
|
# /etc/init.d/autossh
|
|
# and its symbolic link
|
|
# /usr/sbin/rcautossh
|
|
#
|
|
### BEGIN INIT INFO
|
|
# Provides: autossh
|
|
# Required-Start: $local_fs $remote_fs $syslog $network $named sshd
|
|
# Should-Start:
|
|
# Required-Stop: $local_fs $remote_fs $syslog $network $named sshd
|
|
# Should-Stop:
|
|
# Default-Start: 3 5
|
|
# Default-Stop: 0 1 2 6
|
|
# Short-Description: Autossh service
|
|
# Description: Starts autossh as a service daemon
|
|
### END INIT INFO
|
|
|
|
AUTOSSH_BIN=/usr/bin/autossh
|
|
test -x $AUTOSSH_BIN || { echo "$AUTOSSH_BIN not installed";
|
|
if [ "$1" = "stop" ]; then exit 0;
|
|
else exit 5; fi; }
|
|
|
|
AUTOSSH_CONFIG=/etc/sysconfig/autossh
|
|
test -r $AUTOSSH_CONFIG || { echo "$AUTOSSH_CONFIG not existing";
|
|
if [ "$1" = "stop" ]; then exit 0;
|
|
else exit 6; fi; }
|
|
|
|
. $AUTOSSH_CONFIG
|
|
|
|
. /etc/rc.status
|
|
|
|
rc_reset
|
|
|
|
case "$1" in
|
|
start)
|
|
export AUTOSSH_FIRST_POLL="60"
|
|
export AUTOSSH_PIDFILE="/var/run/autossh.pid"
|
|
export AUTOSSH_GATETIME
|
|
export AUTOSSH_LOGLEVEL
|
|
export AUTOSSH_POLL
|
|
export AUTOSSH_PORT
|
|
|
|
echo -n "Starting autossh "
|
|
/sbin/startproc $AUTOSSH_BIN $AUTOSSH_OPTIONS
|
|
|
|
rc_status -v
|
|
;;
|
|
stop)
|
|
echo -n "Shutting down autossh "
|
|
/sbin/killproc $AUTOSSH_BIN
|
|
|
|
rc_status -v
|
|
;;
|
|
try-restart|condrestart)
|
|
if test "$1" = "condrestart"; then
|
|
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
|
|
fi
|
|
$0 status
|
|
if test $? = 0; then
|
|
$0 restart
|
|
else
|
|
rc_reset
|
|
fi
|
|
|
|
rc_status
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
$0 start
|
|
|
|
rc_status
|
|
;;
|
|
force-reload)
|
|
echo -n "Reload service autossh "
|
|
$0 try-restart
|
|
|
|
rc_status
|
|
;;
|
|
status)
|
|
echo -n "Checking for service autossh "
|
|
/sbin/checkproc $AUTOSSH_BIN
|
|
|
|
rc_status -v
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
rc_exit
|