update
This commit is contained in:
@@ -2,29 +2,39 @@
|
|||||||
|
|
||||||
VERS='1.0.0-07152023'
|
VERS='1.0.0-07152023'
|
||||||
|
|
||||||
ESFOLDER=${ESFOLDER}
|
source /opt/idssys/defaults/colors.inc
|
||||||
|
source /opt/idssys/defaults/default.inc
|
||||||
|
source /opt/idssys/emulator-sync/settings.conf
|
||||||
|
|
||||||
|
ESFOLDER=${ESFOLDER}
|
||||||
|
SYNC_FOLDER="${ESFOLDER}/._sync_nextcloud"
|
||||||
|
[ ! -d ${SYNC_FOLDER} ] && mkdir ${SYNC_FOLDER}
|
||||||
|
|
||||||
|
SENDNOTICE(){
|
||||||
|
[ "${PUSHOVER_APP_TOKEN}" != "" ] && PUSH_TO_MOBILE "${2}
|
||||||
|
|
||||||
|
$(date)" "${1}" ${3} &
|
||||||
|
|
||||||
|
[ "${EMAIL_NOTICE}" != "" ] && echo -e "${1}\n\n$(date)" | mail -s "${2}" ${EMAIL_NOTICE}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[ -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
|
[ -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
|
if [ ! -f ${ESFOLDER}/nc-sync.running ]; then
|
||||||
NC_PATH="/mnt/NC-Games"
|
|
||||||
SYNC_FOLDER="/mnt/NC-Games/._sync_nextcloud"
|
|
||||||
|
|
||||||
touch ${ESFOLDER}/nc-sync.running
|
touch ${ESFOLDER}/nc-sync.running
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f ${NC_PATH}/mounted ]; then
|
if [ ! -f ${NC_PATH}/mounted ]; then
|
||||||
/usr/bin/mount -a
|
/usr/bin/mount -a
|
||||||
sleep 5s
|
sleep 5s
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ${NC_PATH}/mounted ] || [ "${1}" == "skipmount" ]; then
|
if [ -f ${NC_PATH}/mounted ] || [ "${1}" == "skipmount" ]; then
|
||||||
[ -f /opt/mount.failure ] && /bin/rm -f /opt/mount.failure
|
[ -f ${ESFOLDER}/mount.failure ] && /bin/rm -f ${ESFOLDER}/mount.failure
|
||||||
if [ -f ${SYNC_FOLDER}/failures.txt ]; then
|
if [ -f ${SYNC_FOLDER}/failures.txt ]; 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
|
SENDNOTICE "Nextcloud Sync Failure" "${SYNC_FOLDER}/failures.txt Exists\n\n$(date)" 1
|
||||||
/bin/rm -f ${ESFOLDER}/nc-sync.running
|
/bin/rm -f ${ESFOLDER}/nc-sync.running
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
@@ -37,19 +47,20 @@ if [ ! -f ${ESFOLDER}/nc-sync.running ]; then
|
|||||||
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
|
||||||
|
SENDNOTICE "Nextcloud Sync Fixed" "Sync is running again"
|
||||||
/bin/rm -f ${SYNC_FOLDER}/failures*
|
/bin/rm -f ${SYNC_FOLDER}/failures*
|
||||||
fi
|
fi
|
||||||
/bin/rm -f ${ESFOLDER}/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 ${ESFOLDER}/mount.failure ]; then
|
||||||
echo -e "The folder ${NC_PATH} Cannot be mounted\n\n$(date)" | mail -s "Nextcloud Sync Unmounted" 9208839613@mms.att.net
|
SENDNOTICE "Nextcloud Sync Unmounted" "The folder ${NC_PATH} Cannot be mounted" 1
|
||||||
/bin/rm -f ${ESFOLDER}/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 ${ESFOLDER}/mount.failure
|
||||||
/bin/rm -f ${ESFOLDER}/nc-sync.running
|
/bin/rm -f ${ESFOLDER}/nc-sync.running
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
|||||||
echo -e "\n${idsCL[LightGreen]}Emulator-Nextcloud-Sync Installation Script${idsCL[Default]}"
|
echo -e "\n${idsCL[LightGreen]}Emulator-Nextcloud-Sync Installation Script${idsCL[Default]}"
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
git clone https://git.schroedercity.com/voltron/emulator-sync.git /opt/idssys/emulator-sync
|
git clone --recursive https://git.schroedercity.com/voltron/emulator-sync.git /opt/idssys/emulator-sync
|
||||||
ln -s /opt/idssys/emulator-sync/run.sh /usr/local/bin/esync
|
ln -s /opt/idssys/emulator-sync/run.sh /usr/local/bin/esync
|
||||||
|
|
||||||
if [ ! -d "/opt/idssys/defaults" ]; then
|
if [ ! -d "/opt/idssys/defaults" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user