Skip to content
Snippets Groups Projects
Commit 7d76c541 authored by nimrod's avatar nimrod
Browse files

Use systemd-run in server-backup.

A little cleaner.
parent 2128d7bf
No related branches found
No related tags found
No related merge requests found
...@@ -8,10 +8,16 @@ usage() { ...@@ -8,10 +8,16 @@ usage() {
if [ "$#" -eq 0 ] if [ "$#" -eq 0 ]
then then
ssh -t host01.shore.co.il -o \ ssh -t host01.shore.co.il -o \
"RemoteCommand tmux new-session -As backup sudo sh -c 'mount /dev/sdb1 /mnt && offsite-backup /mnt && umount /mnt'" "RemoteCommand sudo mount /dev/sdb1 /mnt"
ssh host01.shore.co.il -o \
"RemoteCommand sudo -H systemd-run --unit server-backup --collect sh -c 'offsite-backup /mnt && umount /mnt'"
elif [ "$1" = '-c' ] elif [ "$1" = '-c' ]
then then
if ssh host01.shore.co.il tmux has-session -t backup 2>/dev/null if ssh host01.shore.co.il systemctl --system is-failed server-backup.service >/dev/null
then
echo 'Backup failed.'
exit 1
elif ssh host01.shore.co.il systemctl --system is-active server-backup.service >/dev/null
then then
echo 'Backup is still running.' echo 'Backup is still running.'
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment