More minor fixes

Fixed rsync user and server being overwritten
Added log file outputs for archive-rsync
This commit is contained in:
Gocnak
2018-10-20 06:45:08 -04:00
parent de3371f00c
commit 1648a1993f
2 changed files with 5 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
#!/bin/bash -eu #!/bin/bash -eu
LOG_FILE=/tmp/archive-rsync.log
function log () { function log () {
echo "$( date )" >> "$LOG_FILE" echo "$( date )" >> "$LOG_FILE"
echo "$1" >> "$LOG_FILE" echo "$1" >> "$LOG_FILE"
@@ -7,7 +9,7 @@ function log () {
source /root/.teslaCamRsyncConfig source /root/.teslaCamRsyncConfig
nfiles=$(rsync -auh --stats /mnt/cam/TeslaCam/saved* $user@$server:$path | awk '/files transferred/{print $NF}') nfiles=$(rsync -auvh --stats --log-file=/tmp/archive-rsync-cmd.log /mnt/cam/TeslaCam/saved* $user@$server:$path | awk '/files transferred/{print $NF}')
if [ $nfiles > 0 ] if [ $nfiles > 0 ]
then then

View File

@@ -112,8 +112,8 @@ function configure_archive () {
then then
echo "Configuring for Rsync..." echo "Configuring for Rsync..."
echo "user=$RSYNC_USER" > /root/.teslaCamRsyncConfig echo "user=$RSYNC_USER" > /root/.teslaCamRsyncConfig
echo "server=$RSYNC_SERVER" > /root/.teslaCamRsyncConfig echo "server=$RSYNC_SERVER" >> /root/.teslaCamRsyncConfig
echo "path=$RSYNC_PATH" > /root/.teslaCamRsyncConfig echo "path=$RSYNC_PATH" >> /root/.teslaCamRsyncConfig
else else
echo "Configuring for a shared drive..." echo "Configuring for a shared drive..."
mkdir /mnt/archive mkdir /mnt/archive