1 #!/sbin/openrc-run 2 # 3 # DESCRIPTION 4 # 5 # Startup init script for BackupPC on Gentoo` linux. 6 # 7 # Distributed with BackupPC version 4.4.0, released 20 Jun 2020. 8 # 9 # description: Starts and stops the BackupPC server 10 # Copy to /etc/init.d and run 'rc-update add backuppc default' 11 12 # get our configuration options 13 source /etc/conf.d/backuppc 14 15 checkconfig() { 16 if [ ! -f ${CONF_FILE} ] ; then 17 eerror "No ${CONF_FILE} exists!" 18 fi 19 } 20 21 start() { 22 checkconfig || return 1 23 24 PID_DIR=$(dirname "${PID_FILE}") 25 mkdir -p "${PID_DIR}" || return 1 26 chown ${USER}:${USER} "${PID_DIR}" || return 1 27 28 ebegin "Starting BackupPC" 29 start-stop-daemon --start --user ${USER} --group ${USER} --make-pidfile --pidfile ${PID_FILE} --exec ${EXEC} -- ${EXEC_OPTIONS} 30 eend $? 31 } 32 33 stop() { 34 ebegin "Stopping BackupPC" 35 start-stop-daemon --stop --pidfile ${PID_FILE} --name BackupPC 36 eend $? 37 } 38 39 restart() { 40 ebegin "Restarting BackupPC" 41 svc_stop 42 sleep 1 43 svc_start 44 eend $? "Failed to restart BackupPC" 45 } 46 47 status() { 48 return 49 eend $? 50 }