1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
[Unit]
Description=Run storeBackup for all configs in /etc/storebackup.d
Documentation=man:storeBackup(1) man:storeBackupUpdateBackup(1)
[Service]
Type=oneshot
Environment="PATH=/bin:/sbin:/usr/bin:/usr/sbin"
User=root
# Run the same loop as the cron job
ExecStart=/bin/sh -c '\
configs=$(run-parts --list /etc/storebackup.d/) && \
[ "$configs" ] || exit 0; \
delayed_error=; \
tmplog=$(mktemp -t storebackup.XXXXXXXXXX); \
for file in $configs; do \
if ! nice storeBackup -f "$file" >"$tmplog" 2>&1; then \
echo "Error running backup for $file" >&2; \
cat "$tmplog" >&2; \
delayed_error=1; \
fi; \
done; \
rm -f "$tmplog"; \
[ -z "$delayed_error" ] || exit 1 \
'
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7
StandardOutput=journal
StandardError=journal
|