Commit 98eb484c authored by sokai's avatar sokai

cosmetic and variables renamed for new upgrade cron

parent 5d1d57b1
......@@ -13,18 +13,22 @@ UPDATEURL='http://freifunk-potsdam.de/apdb/ap.php'
UPGRADEURL='http://freifunk-potsdam.de/ffp-apdb.php'
##### ----- do NOT edit from this line on ----- #####
## needed for init script; do: https://wiki.openwrt.org/doc/techref/initscripts
## init variables; https://wiki.openwrt.org/doc/techref/initscripts
START=99
EXTRA_COMMANDS="status update upgrade"
## script
## script variables
SCRIPTVERSION='160201-1'
SCRIPT=${SCRIPTPATH}${SCRIPTNAME}
CRONTABPATH='/var/spool/cron/crontabs/' # _with_ trailing / !
CRONTABUSER='root'
CRONTAB="${CRONTABPATH}${CRONTABUSER}"
CRONINTERVAL=$(awk 'BEGIN{srand();print int(rand()*60)}') # run cron hourly at a random minute
CRONTAB=${CRONTABPATH}${CRONTABUSER}
UPDATEINTERVAL=$(awk 'BEGIN{srand();print int(rand()*60)}') # run cron hourly at a random minute
UPGRADEMINUTE=$(awk 'BEGIN{srand();print int(rand()*60)}') # random minute for upgrade cron
UPGRADEHOUR=$(awk 'BEGIN{srand();print int(rand()*25)}') # random hour for upgrade cron
UPGRADEDAY='1'
## spript
WIF=$(ifconfig | awk '/10\.22\.[0-9]{1,3}\.[0-9]{1,3}/ {print $1}' RS="\n\n" | grep -m 1 wlan) # http://stackoverflow.com/a/18344694/338049
#WIF= uci show = [email protected][0].ifname=wlan0-adhoc-2
NEWWIF=$(ifconfig | awk '/10\.22\.(250|254|256)\.[0-9]{1,3}/ {print $1}' RS="\n\n" | grep -m 1 wlan)
......@@ -49,7 +53,7 @@ SYSTEMTYPE=$(grep 'system type' /proc/cpuinfo|awk '{$1=$2=""; print}'| sed 's/
start() {
if ! $(grep -q ${SCRIPT} ${CRONTAB}); then
CRONJOB="${CRONINTERVAL} * * * * ${SCRIPT} update # FreiFunkPotsdam-AccessPointsDataBase"
CRONJOB="${UPDATEINTERVAL} * * * * ${SCRIPT} update # FreiFunkPotsdam-AccessPointsDataBase"
echo "${CRONJOB}" >> ${CRONTAB}
echo "${CRONTABUSER}" > ${CRONTABPATH}cron.update # reload crontab
logger -t ${SCRIPTNAME} "cron job for user ${CRONTABUSER} added (${SCRIPT} start)"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment