#!/bin/sh
#
# DESCRIPTION
#
# Startup init script for BackupPC on Redhat linux.
#
# Distributed with BackupPC version 4.0.0alpha3, released 1 Dec 2013.
#
# chkconfig: - 91 35
# description: Starts and stops the BackupPC server
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
exit 0
fi
RETVAL=0
start() {
# Make sure /var/run/BackupPC tempfs exisits
checkTempFs
#
# You can set the SMB share password here is you wish. Otherwise
# If you put it here make sure this file has no read permissions
# for normal users! See the documentation for more information.
#
# Replace the daemon line below with this:
#
# daemon --user backuppc /usr/bin/env BPC_SMB_PASSWD=xxxxx \
# /usr/local/BackupPC/bin/BackupPC -d
#
echo -n "Starting BackupPC: "
daemon --user backuppc /usr/local/BackupPC/bin/BackupPC -d
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/backuppc || \
RETVAL=1
return $RETVAL
}
stop() {
echo -n "Shutting down BackupPC: "
killproc /usr/local/BackupPC/bin/BackupPC
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/backuppc
echo ""
return $RETVAL
}
restart() {
stop
start
}
reload() {
killproc /usr/local/BackupPC/bin/BackupPC -HUP
RETVAL=$?
echo
return $RETVAL
}
rhstatus() {
status /usr/local/BackupPC/bin/BackupPC
}
checkTempFs() {
if `test -d /var/run/BackupPC`; then
echo "BackupPC tempfs exisits"
else
mkdir -p /var/run/BackupPC
chown backuppc:backuppc /var/run/BackupPC
echo "BackupPC tempfs created"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
status)
rhstatus
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit $?