You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
9 years ago
|
#!/bin/bash
|
||
|
|
||
|
prefix="@prefix@"
|
||
|
exec_prefix="@exec_prefix@"
|
||
|
|
||
|
# first check for critical backups and execute the first one
|
||
|
for b in "@sysconfdir@"/cron.{hourly,daily,monthly,weekly}/backup-*; do
|
||
|
if [ -e "$b" ]; then
|
||
|
p=${b#"@sysconfdir@"/cron.}; p=${p%/*};
|
||
|
h=${b#"@sysconfdir@"/cron.*/backup-}; h=${h//_/.};
|
||
|
"@libdir@/nagios/plugins/check_backup" $h $p \
|
||
|
| grep -q "backup is running"
|
||
|
if [ ${PIPESTATUS[1]} -eq 2 -a ${PIPESTATUS[0]} -ne 0 ]; then
|
||
|
# backup is faulty and not running
|
||
|
# immediate backup required start it now
|
||
|
$b
|
||
|
exit
|
||
|
fi
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
# first check for warning backups and execute the first one
|
||
|
for b in "@sysconfdir@"/cron.{hourly,daily,monthly,weekly}/backup-*; do
|
||
|
if [ -e "$b" ]; then
|
||
|
p=${b#"@sysconfdir@"/cron.}; p=${p%/*};
|
||
|
h=${b#"@sysconfdir@"/cron.*/backup-}; h=${h//_/.};
|
||
|
"@libdir@/nagios/plugins/check_backup" $h $p \
|
||
|
| grep -q "backup is running"
|
||
|
if [ ${PIPESTATUS[1]} -eq 1 -a ${PIPESTATUS[0]} -ne 0 ]; then
|
||
|
# backup is faulty and not running
|
||
|
# immediate backup required start it now
|
||
|
$b
|
||
|
exit
|
||
|
fi
|
||
|
fi
|
||
|
done
|