Refactor to use rsync server

This commit is contained in:
dwrz
2023-05-28 18:28:18 +00:00
parent 7501d00d76
commit 6ef6f554ce
3 changed files with 26 additions and 14 deletions
+14
View File
@@ -21,6 +21,8 @@ MOTION_LOG_FILE="/var/log/motion/motion.log"
MOTION_PASSWORD="$(tr -dc A-Za-z0-9 </dev/urandom | head -c 24 ; echo '')"
MOTION_USER="${USER}"
NOTIFICATION_RECIPIENT="1234567890@sms.example.com"
RSYNC_USER="user"
RSYNC_SERVER="server"
PORT_CONTROL="8080"
PORT_STREAM="3000"
TLS_CERT="/etc/letsencrypt/live/${DOMAIN}/fullchain.pem"
@@ -85,6 +87,14 @@ input_settings() {
read -r input
PORT_STREAM="${input:-$PORT_STREAM}"
printf "rsync user (%s): " "${RSYNC_USER}"
read -r input
RSYNC_USER="${input:-$RSYNC_USER}"
printf "rsync server (%s): " "${RSYNC_SERVER}"
read -r input
RSYNC_SERVER="${input:-$RSYNC_SERVER}"
printf "TLS certifcate path (%s): " "${TLS_CERT}"
read -r input
TLS_CERT="${input:-$TLS_CERT}"
@@ -109,6 +119,8 @@ print_settings() {
printf "Motion password: %s\n" "${MOTION_PASSWORD}"
printf "Webcontrol port: %s\n" "${PORT_CONTROL}"
printf "Livestream port: %s\n" "${PORT_STREAM}"
printf "rsync user: %s\n" "${RSYNC_USER}"
printf "rsync server: %s\n" "${RSYNC_SERVER}"
printf "Notification recipient: %s\n" "${NOTIFICATION_RECIPIENT}"
printf "TLS certificate: %s\n" "${TLS_CERT}"
printf "TLS key: %s\n" "${TLS_KEY}"
@@ -130,6 +142,8 @@ write_settings() {
sed -i 's|\${NOTIFICATION_RECIPIENT}|'"${NOTIFICATION_RECIPIENT}"'|g' "${f}"
sed -i 's|\${PORT_CONTROL}|'"${PORT_CONTROL}"'|g' "${f}"
sed -i 's|\${PORT_STREAM}|'"${PORT_STREAM}"'|g' "${f}"
sed -i 's|\${RSYNC_USER}|'"${RSYNC_USER}"'|g' "${f}"
sed -i 's|\${RSYNC_SERVER}|'"${RSYNC_SERVER}"'|g' "${f}"
sed -i 's|\${TLS_CERT}|'"${TLS_CERT}"'|g' "${f}"
sed -i 's|\${TLS_KEY}|'"${TLS_KEY}"'|g' "${f}"
done