Update emulator-sync-scripts.sh
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
[ -f /opt/nc-sync.running ] && [ $(expr $(date +%s) - $(stat -L --format %Y /opt/nc-sync.running)) -gt 21600 ] && /bin/rm -f /opt/nc-sync.running
|
||||
VERS='1.0.0-07152023'
|
||||
|
||||
if [ ! -f /opt/nc-sync.running ]; then
|
||||
ESFOLDER=${ESFOLDER}
|
||||
|
||||
|
||||
[ -f ${ESFOLDER}/nc-sync.running ] && [ $(expr $(date +%s) - $(stat -L --format %Y ${ESFOLDER}/nc-sync.running)) -gt 21600 ] && /bin/rm -f ${ESFOLDER}/nc-sync.running
|
||||
|
||||
if [ ! -f ${ESFOLDER}/nc-sync.running ]; then
|
||||
NC_PATH="/mnt/NC-Games"
|
||||
SYNC_FOLDER="/mnt/NC-Games/._sync_nextcloud"
|
||||
|
||||
touch /opt/nc-sync.running
|
||||
touch ${ESFOLDER}/nc-sync.running
|
||||
|
||||
|
||||
if [ ! -f ${NC_PATH}/mounted ]; then
|
||||
@@ -20,7 +25,7 @@ if [ ! -f /opt/nc-sync.running ]; then
|
||||
if [ -f ${SYNC_FOLDER}/failures2.txt ]; then
|
||||
echo "Nextcloud sync failure, ${SYNC_FOLDER}/failures.txt exists."
|
||||
echo -e "${SYNC_FOLDER}/failures.txt Exists\n\n$(date)" | mail -s "Nextcloud Sync Failure" 9208839613@mms.att.net
|
||||
/bin/rm -f /opt/nc-sync.running
|
||||
/bin/rm -f ${ESFOLDER}/nc-sync.running
|
||||
exit 1
|
||||
else
|
||||
/bin/mv ${SYNC_FOLDER}/failures.txt ${SYNC_FOLDER}/failures2.txt
|
||||
@@ -28,24 +33,24 @@ if [ ! -f /opt/nc-sync.running ]; then
|
||||
fi
|
||||
if [ ! -f ${SYNC_FOLDER}/failures.txt ]; then
|
||||
echo "Sync Started"
|
||||
/opt/nextcloud-sync-cron/nextcloud-sync-cron.sh --verbose /opt/nextcloud-sync-cron/nextcloud-client.conf
|
||||
${ESFOLDER}/nextcloud-sync-cron/nextcloud-sync-cron.sh --verbose ${ESFOLDER}/nextcloud-client.conf
|
||||
echo "Sync Finished"
|
||||
if [ -f ${SYNC_FOLDER}/failures2.txt ] && [ ! -f ${SYNC_FOLDER}/failures.txt ]; then
|
||||
echo "$(date): Fixed" >> ${NC_PATH}/sync.log
|
||||
/bin/rm -f ${SYNC_FOLDER}/failures*
|
||||
fi
|
||||
/bin/rm -f /opt/nc-sync.running
|
||||
/bin/rm -f ${ESFOLDER}/nc-sync.running
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
if [ -f /opt/mount.failure ]; then
|
||||
echo -e "The folder ${NC_PATH} Cannot be mounted\n\n$(date)" | mail -s "Nextcloud Sync Unmounted" 9208839613@mms.att.net
|
||||
/bin/rm -f /opt/nc-sync.running
|
||||
/bin/rm -f ${ESFOLDER}/nc-sync.running
|
||||
exit 1
|
||||
else
|
||||
/usr/bin/mount -a
|
||||
touch /opt/mount.failure
|
||||
/bin/rm -f /opt/nc-sync.running
|
||||
/bin/rm -f ${ESFOLDER}/nc-sync.running
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user