Compare commits

...
5 Commits
Author SHA1 Message Date
matthias 9c3764c7ff disabled hostkey check
continuous-integration/drone/push Build is passing
2021-05-27 10:21:33 +02:00
matthias c72a1f81ce updated healthcheck call
continuous-integration/drone/push Build is passing
2021-05-27 10:08:07 +02:00
matthias e7738b1a71 fixed missing fi
continuous-integration/drone/push Build is passing
2021-05-27 07:19:59 +02:00
matthias 7f06058b44 added sshpass and sftp
continuous-integration/drone/push Build is passing
2021-05-27 07:06:40 +02:00
matthias 841f35ca06 added extra parameter for sftp
continuous-integration/drone/push Build is passing
2021-05-27 06:51:04 +02:00
2 changed files with 10 additions and 5 deletions
+2
View File
@@ -8,6 +8,8 @@ RUN apk add --update \
tar \
sed \
xz \
sshpass \
openssh-client \
tzdata \
&& rm -rf /var/cache/apk/*
+8 -5
View File
@@ -19,20 +19,20 @@ fi
rm -f ~/$BACKUP_FILENAME.gpg ~/$BACKUP_FILENAME
healthchck_fail(){
if [ -n $HEALTHCHECK_URL ]; then
if [ -n "$HEALTHCHECK_URL" ]; then
curl -X POST --data "$*" --retry 3 $HEALTHCHECK_URL/fail --silent --output /dev/null
exit 1
fi
}
healthchck_start(){
if [ -n $HEALTHCHECK_URL ]; then
if [ -n "$HEALTHCHECK_URL" ]; then
curl -X POST --data "$*" --retry 3 $HEALTHCHECK_URL/start --silent --output /dev/null
fi
}
healthchck_ok(){
if [ -n $HEALTHCHECK_URL ]; then
if [ -n "$HEALTHCHECK_URL" ]; then
curl -X POST --data "$*" --retry 3 $HEALTHCHECK_URL --silent --output /dev/null
fi
}
@@ -60,15 +60,16 @@ rm ~/$BACKUP_FILENAME
echo "uploading"
if [ "$USE_SFTP" -eq 1 ]; then
echo "use sftp"
cd ~/
sshpass -e sftp -oBatchMode=no -b - ${SFTP_USER}@${SFTP_HOST} << !
sshpass -e sftp -oStrictHostKeyChecking=no -oBatchMode=no ${SFTP_EXTRA} -b - ${SFTP_USER}@${SFTP_HOST} << !
cd ${SFTP_PATH}
put ${BACKUP_FILENAME}.gpg
bye
!
if [ "$month_day" -eq 1 ] ; then
echo "make monthly backup"
sshpass -e sftp -oBatchMode=no -b - ${SFTP_USER}@${SFTP_HOST} << !
sshpass -e sftp -oStrictHostKeyChecking=no -oBatchMode=no ${SFTP_EXTRA} -b - ${SFTP_USER}@${SFTP_HOST} << !
cd ${SFTP_PATH}
cp ${BACKUP_FILENAME}.gpg ${BACKUP_FILENAME_MONTHLY}.gpg
bye
@@ -97,4 +98,6 @@ else
aws ${AWS_ENDPOINT_OPTIOM} s3 cp s3://$S3_BUCKET_NAME/$BACKUP_FILENAME.gpg s3://$S3_BUCKET_NAME/$BACKUP_FILENAME_MONTHLY.gpg --storage-class DEEP_ARCHIVE || healthchck_fail "failed to create monthly backup"
fi
fi
fi
healthchck_ok "Success"