docker-images/borgbackup_alpine_runner/run_borg.sh
nikurasu 411cb2be6a
feat(Inital Commit):
Initial Commit UwU
Add borg backup, dev-alpine, download-tools docker
2024-01-21 17:22:51 +01:00

22 lines
No EOL
630 B
Bash
Executable file

#!/usr/bin/env bash
while getopts d:u:s:r:n: flag
do
case "${flag}" in
d) bkp_dir=${OPTARG};;
u) user=${OPTARG};;
s) server=${OPTARG};;
r) repository=${OPTARG};;
n) backupname=${OPTARG};;
esac
done
echo "Copy ssh priv key"
mkdir $HOME/.ssh
mkdir /logs
cp /ssh_privKey $HOME/.ssh/id_rsa
chown $(id -u):$(id -g) $HOME/.ssh/id_rsa
ssh-keyscan -t rsa $SERVER >> ~/.ssh/known_hosts
echo "Borg starting"
echo $(date +%s) > /logs/starttime
borg create -C lzma ${user}@${server}:${bkp_dir}${repository}::${backupname}_$(date -I'minutes') /backup
exitCode=$?
echo $(date +%s) > /logs/endtime