Skip to content
Permalink
Browse files

Move non-update tasks outside the quickfix script

  • Loading branch information...
NEMS Linux
NEMS Linux committed Mar 28, 2019
1 parent 701c51c commit 1f9e386c263f9f1750e8b6a72417aa4312417376
Showing with 37 additions and 26 deletions.
  1. +33 −0 daily
  2. +4 −26 quickfix.sh
33 daily
@@ -0,0 +1,33 @@
#!/bin/bash

# These are initiated by nems-quickfix (daily cron)
# However they are NOT system updates, so they ignore the update settings
# By contrast, these are just local cleanup operations not involving updates

echo "Running cleanup tasks..."

if [[ -f /var/www/nconf/temp/generate.lock ]]; then
printf "Resetting NEMS NConf generate.lock..."
rm -f /var/www/nconf/temp/generate.lock
sleep 1
echo " done."
fi

printf "Setting Internet speedtest server..."
# Detect current first since this will create the conf if missing
speedtestcurrent=`/usr/local/bin/nems-info speedtest`
# Detect the best server
speedtestbest=`/usr/local/bin/nems-info speedtest best`
# Overwrite the conf
if (( $speedtestcurrent != $speedtestbest )); then
if (( $speedtestbest > 0 )); then
/bin/sed -i~ '/speedtestserver/d' /usr/local/share/nems/nems.conf
echo "speedtestserver=$speedtestbest" >> /usr/local/share/nems/nems.conf
echo " done."
else
echo " couldn't detect server."
fi
else
echo " no change."
fi

@@ -15,38 +15,13 @@ allowupdate=`/usr/local/bin/nems-info allowupdate`

# Wait for 90 seconds if system just booted
suptime=$(awk '{print $1}' /proc/uptime)
# remove decimal place
suptime=${suptime%.*}
while (( $suptime < 120 )); do
echo "System is still loading. Please wait..."
sleep 90
done

if [[ -f /var/www/nconf/temp/generate.lock ]]; then
printf "Resetting NEMS NConf generate.lock..."
rm -f /var/www/nconf/temp/generate.lock
sleep 1
echo " done."
fi

printf "Setting Internet speedtest server..."
# Detect current first since this will create the conf if missing
speedtestcurrent=`/usr/local/bin/nems-info speedtest`
# Detect the best server
speedtestbest=`/usr/local/bin/nems-info speedtest best`
# Overwrite the conf
if (( $speedtestcurrent != $speedtestbest )); then
if (( $speedtestbest > 0 )); then
/bin/sed -i~ '/speedtestserver/d' /usr/local/share/nems/nems.conf
echo "speedtestserver=$speedtestbest" >> /usr/local/share/nems/nems.conf
echo " done."
else
echo " couldn't detect server."
fi
else
echo " no change."
fi


# 1 = Not allowed
# 2 = Allowed monthly
# 3 = Allowed semi-weekly
@@ -103,4 +78,7 @@ else
echo "Update Skipped based on settings in NEMS SST."
fi

# Run tasks which need to run daily
/usr/local/share/nems/nems-scripts/daily

rm -f /var/run/nems-quickfix.pid

0 comments on commit 1f9e386

Please sign in to comment.
You can’t perform that action at this time.