%PDF- %PDF-
| Direktori : /opt/veeam/transport/scripts/ |
| Current File : //opt/veeam/transport/scripts/veeamtransport |
#! /bin/sh
### BEGIN INIT INFO
# Provides: veeamtransport
# Required-Start: $local_fs $remote_fs $syslog $network
# Required-Stop: $local_fs $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Veeam Transport for Linux service daemon
### END INIT INFO
# Author: Veeam Software Group GmbH <https://www.veeam.com/contacts.html>
# Do NOT "set -e"
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Veeam Transport for Linux service"
NAME=veeamtransport
DAEMON=/opt/veeam/transport/$NAME
PIDFILE=/var/run/$NAME.pid
#PORT=%PORT%
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
#[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
#. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
#. /lib/lsb/init-functions
#
# Function that gets daemon pid
#
get_pid() {
cat "$PIDFILE"
}
#
# Function that check whether daemon is running
#
is_running() {
[ -f "$PIDFILE" ] && ps -p `get_pid` > /dev/null 2>&1
}
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
$DAEMON --start-service || return 0
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
PID=`get_pid`
$DAEMON --stop-service
tail --pid=$PID -f /dev/null
RETVAL="$?"
return "$RETVAL"
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
if is_running; then
do_stop
fi
case "$?" in
0|1)
do_start
case "$?" in
0) #log_end_msg 0
;;
1) #log_end_msg 1
;; # Old process is still running
*) #log_end_msg 1
;; # Failed to start
esac
;;
*)
# Failed to stop
#log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
exit 3
;;
esac
: