Update emulator-sync-scripts.sh
This commit is contained in:
@@ -1,12 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/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"
|
NC_PATH="/mnt/NC-Games"
|
||||||
SYNC_FOLDER="/mnt/NC-Games/._sync_nextcloud"
|
SYNC_FOLDER="/mnt/NC-Games/._sync_nextcloud"
|
||||||
|
|
||||||
touch /opt/nc-sync.running
|
touch ${ESFOLDER}/nc-sync.running
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f ${NC_PATH}/mounted ]; then
|
if [ ! -f ${NC_PATH}/mounted ]; then
|
||||||
@@ -20,7 +25,7 @@ if [ ! -f /opt/nc-sync.running ]; then
|
|||||||
if [ -f ${SYNC_FOLDER}/failures2.txt ]; then
|
if [ -f ${SYNC_FOLDER}/failures2.txt ]; then
|
||||||
echo "Nextcloud sync failure, ${SYNC_FOLDER}/failures.txt exists."
|
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
|
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
|
exit 1
|
||||||
else
|
else
|
||||||
/bin/mv ${SYNC_FOLDER}/failures.txt ${SYNC_FOLDER}/failures2.txt
|
/bin/mv ${SYNC_FOLDER}/failures.txt ${SYNC_FOLDER}/failures2.txt
|
||||||
@@ -28,24 +33,24 @@ if [ ! -f /opt/nc-sync.running ]; then
|
|||||||
fi
|
fi
|
||||||
if [ ! -f ${SYNC_FOLDER}/failures.txt ]; then
|
if [ ! -f ${SYNC_FOLDER}/failures.txt ]; then
|
||||||
echo "Sync Started"
|
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"
|
echo "Sync Finished"
|
||||||
if [ -f ${SYNC_FOLDER}/failures2.txt ] && [ ! -f ${SYNC_FOLDER}/failures.txt ]; then
|
if [ -f ${SYNC_FOLDER}/failures2.txt ] && [ ! -f ${SYNC_FOLDER}/failures.txt ]; then
|
||||||
echo "$(date): Fixed" >> ${NC_PATH}/sync.log
|
echo "$(date): Fixed" >> ${NC_PATH}/sync.log
|
||||||
/bin/rm -f ${SYNC_FOLDER}/failures*
|
/bin/rm -f ${SYNC_FOLDER}/failures*
|
||||||
fi
|
fi
|
||||||
/bin/rm -f /opt/nc-sync.running
|
/bin/rm -f ${ESFOLDER}/nc-sync.running
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -f /opt/mount.failure ]; then
|
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
|
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
|
exit 1
|
||||||
else
|
else
|
||||||
/usr/bin/mount -a
|
/usr/bin/mount -a
|
||||||
touch /opt/mount.failure
|
touch /opt/mount.failure
|
||||||
/bin/rm -f /opt/nc-sync.running
|
/bin/rm -f ${ESFOLDER}/nc-sync.running
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user