37 lines
739 B
Plaintext
37 lines
739 B
Plaintext
#!/sbin/openrc-run
|
|
# OpenRC service for backup network trigger
|
|
# Monitors NAS availability and triggers backups when detected
|
|
|
|
name="backup-monitor"
|
|
description="Backup network trigger service"
|
|
|
|
command="/usr/local/bin/backup-trigger"
|
|
command_background="yes"
|
|
pidfile="/run/${RC_SVCNAME}.pid"
|
|
|
|
depend() {
|
|
need net
|
|
use NetworkManager
|
|
after NetworkManager
|
|
}
|
|
|
|
start_pre() {
|
|
# Ensure command exists
|
|
if [ ! -x "$command" ]; then
|
|
eerror "Backup trigger script not found: $command"
|
|
return 1
|
|
fi
|
|
|
|
# Check config exists
|
|
if [ ! -f /etc/backup.conf ]; then
|
|
eerror "Backup configuration not found: /etc/backup.conf"
|
|
return 1
|
|
fi
|
|
|
|
ebegin "Starting backup monitor"
|
|
}
|
|
|
|
stop_post() {
|
|
eend $? "Stopped backup monitor"
|
|
}
|