|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
--- |
|
|
|
|
title: From crontabs to Systemd timers |
|
|
|
|
tags: [bash, shell, crontab, cronie, systemd, timer] |
|
|
|
|
updated: 2019-07-04 19:38 |
|
|
|
|
updated: 2019-07-07 00:06 |
|
|
|
|
description: A detailed exaplanation of my backup system which is both encrypted and unencrypted for different purposes. |
|
|
|
|
--- |
|
|
|
|
|
|
|
|
@ -122,11 +122,15 @@ called `deploy.sh`, which needs to be placed in `/home/jobs/services`.
|
|
|
|
|
|
|
|
|
|
set -euo pipefail |
|
|
|
|
|
|
|
|
|
SRC_DIR='by-user/' |
|
|
|
|
DST_DIR='/etc/systemd/system' |
|
|
|
|
|
|
|
|
|
[ ${UID} -eq 0 ] |
|
|
|
|
|
|
|
|
|
find by-user/ -type f -exec cp {} /etc/systemd/system \; |
|
|
|
|
find "${SRC_DIR}" \( -name "*.service" -o -name "*.timer" \) \ |
|
|
|
|
-type f -exec cp {} "${DST_DIR}" \; |
|
|
|
|
systemctl daemon-reload |
|
|
|
|
timers=$(find by-user/ -name *.timer -type f -printf "%f\n") |
|
|
|
|
timers=$(find "${SRC_DIR}" -name "*.timer" -type f -printf "%f\n") |
|
|
|
|
systemctl start ${timers} |
|
|
|
|
systemctl enable ${timers} |
|
|
|
|
``` |
|
|
|
|