mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-12-23 18:55:03 +01:00
30 lines
791 B
Django/Jinja
30 lines
791 B
Django/Jinja
#!/bin/sh
|
|
|
|
# log command
|
|
if [ -n "$SSH_ORIGINAL_COMMAND" ]
|
|
then
|
|
echo "`/bin/date`: $SSH_ORIGINAL_COMMAND" | systemd-cat -t "ssh-wrapper.sh"
|
|
fi
|
|
|
|
# define executable commands
|
|
hashed_machine_id_command="sha256sum /etc/machine-id";
|
|
find_command="find /Backups/{{hashed_machine_id.stdout}}/ -maxdepth 1 -type d";
|
|
rsync_command="sudo rsync --server --sender -blogDtpre.iLsfxCIvu --backup-dir /Backups/{{hashed_machine_id.stdout}}/docker-volume-backup/diffs/current/ . /Backups/{{hashed_machine_id.stdout}}/docker-volume-backup/latest/"
|
|
|
|
# filter commands
|
|
case "$SSH_ORIGINAL_COMMAND" in
|
|
"$hashed_machine_id_command")
|
|
$hashed_machine_id_command
|
|
;;
|
|
"$find_command")
|
|
$find_command
|
|
;;
|
|
"$rsync_command")
|
|
$rsync_command
|
|
;;
|
|
*)
|
|
echo "This command is not supported."
|
|
exit 1
|
|
;;
|
|
esac
|