diff --git a/README.md b/README.md index b3fdff1..0eecbed 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ All running Nspawn containers are stopped, snapshoted (using Btrfs subvolumes) a * `variables.conf.template` contains examples variables definitions, and should be copied locally to `variables.conf` (with any required modifications). * `systemd-templates/` contains Systemd units templates for running the scripts unattended. - * specifically, `machines-start.timer` is a daily permanent trigger to start all enabled containers. + * specifically, `machines-start.timer` and `machines-start.service` form a daily permanent trigger to start all + enabled containers. #### Installation * `install.sh` script copies Systemd templates to their destination, and enables conts-snap and docker-upgrade timer. diff --git a/install.sh b/install.sh index 8d985cd..8a2e86f 100755 --- a/install.sh +++ b/install.sh @@ -21,6 +21,7 @@ $sudo cp systemd-templates/cont-snap@.service /etc/systemd/system/ $sudo cp systemd-templates/conts-snap.service /etc/systemd/system/ $sudo sed -i -e "s:PH_DIRECTORY:$run_directory:g" /etc/systemd/system/conts-snap.service $sudo cp systemd-templates/conts-snap.timer /etc/systemd/system/ +$sudo cp systemd-templates/machines-start.service /etc/systemd/system/ $sudo cp systemd-templates/machines-start.timer /etc/systemd/system/ if [ $docker -eq 1 ]; then $sudo cp systemd-templates/docker-upgrade.service /etc/systemd/system/ diff --git a/systemd-templates/machines-start.service b/systemd-templates/machines-start.service new file mode 100644 index 0000000..b314d2d --- /dev/null +++ b/systemd-templates/machines-start.service @@ -0,0 +1,6 @@ +[Unit] +Description=Force start machines.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/systemctl start machines.target diff --git a/systemd-templates/machines-start.timer b/systemd-templates/machines-start.timer index d8a7f69..5e08b56 100644 --- a/systemd-templates/machines-start.timer +++ b/systemd-templates/machines-start.timer @@ -2,7 +2,7 @@ Description=Make sure containers are started after snapshoting [Timer] -Unit=machines.target +Unit=machines-start.service OnCalendar=*-*-* 04:15:00 Persistent=true