feat(borg-runner): Support different ssh port

Add support for different remote ssh port
This commit is contained in:
nikurasu 2024-01-27 19:57:31 +01:00
parent 411cb2be6a
commit 1df17edee9
Signed by: Nikurasu
GPG key ID: 9E7F14C03EF1F271
2 changed files with 4 additions and 2 deletions

View file

@ -2,4 +2,4 @@ FROM alpine:3.19
RUN apk --no-cache add openssh borgbackup bash tzdata RUN apk --no-cache add openssh borgbackup bash tzdata
COPY ./run_borg.sh /run_borg.sh COPY ./run_borg.sh /run_borg.sh
VOLUME [ "/backup", "/ssh_privKey" ] VOLUME [ "/backup", "/ssh_privKey" ]
CMD /run_borg.sh -d $BKP_DIR -u $USER -s $SERVER -r $REPOSITORY -n $BACKUPNAME CMD /run_borg.sh -d $BKP_DIR -u $USER -s $SERVER -p $SSH_PORT -r $REPOSITORY -n $BACKUPNAME

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
while getopts d:u:s:r:n: flag while getopts d:u:s:r:n:p: flag
do do
case "${flag}" in case "${flag}" in
d) bkp_dir=${OPTARG};; d) bkp_dir=${OPTARG};;
@ -7,8 +7,10 @@ do
s) server=${OPTARG};; s) server=${OPTARG};;
r) repository=${OPTARG};; r) repository=${OPTARG};;
n) backupname=${OPTARG};; n) backupname=${OPTARG};;
p) port=${OPTARG};;
esac esac
done done
BORG_RSH='ssh -p ${port}'
echo "Copy ssh priv key" echo "Copy ssh priv key"
mkdir $HOME/.ssh mkdir $HOME/.ssh
mkdir /logs mkdir /logs