2
2
3
3
#
4
4
# EdgeMAX Wizard "OLSRd_V1" created 03/2016 by Onetrix.net for FunkFeuer.at
5
- # Version [0903k/201810090 ]
5
+ # Version [0903k/201810150 ]
6
6
# ^-- previous line is used from bmk-webstatus-package as version identification, dont remove "Version "
7
7
#
8
8
# Github repository: https://github.com/vchrizz/ER-wizard-OLSRd_V1/
@@ -158,15 +158,15 @@ else
158
158
fi
159
159
fi
160
160
if [ ! -f /etc/cron.d/olsrdwatchdog ] &&
161
- [ -f $olsrd4default ] && [ $(cat $olsrd4default | cut -d "#" -f 1 | grep -c START_OLSRD=\"YES\") \> 0 ] &&
161
+ [ -f $olsrd4default ] && [ $(cat $olsrd4default | cut -d "#" -f 1 | grep -c ' START_OLSRD=\"YES\"' ) \> 0 ] &&
162
162
[ $(cat $olsrd4config | cut -d "#" -f 1 | grep -c LoadPlugin.*olsrd_watchdog) \> 0 ] &&
163
163
[ -x /etc/olsrdwatchdog ] ; then
164
164
echo add watchdog to crontab
165
165
echo "* * * * * root /etc/olsrdwatchdog >/dev/null 2>/dev/null" >/etc/cron.d/olsrdwatchdog
166
166
chmod 744 /etc/cron.d/olsrdwatchdog
167
167
fi
168
168
if [ ! -f $olsrd4default ] ||
169
- [ $(cat $olsrd4default | cut -d "#" -f 1 | grep -c START_OLSRD=\"YES\") -eq 0 ] ||
169
+ [ $(cat $olsrd4default | cut -d "#" -f 1 | grep -c ' START_OLSRD=\"YES\"' ) -eq 0 ] ||
170
170
[ $(cat $olsrd4config | cut -d "#" -f 1 | grep -c LoadPlugin.*olsrd_watchdog) -eq 0 ] ||
171
171
[ ! -x /etc/olsrdwatchdog ]; then
172
172
if [ -f /etc/cron.d/olsrdwatchdog ]; then
@@ -400,7 +400,7 @@ if [ -f $olsrd4init ] && [ $(grep -c "rm /etc/cron.d/olsrdwatchdog" $olsrd4init)
400
400
linenumber=$(($(grep -n 'start-stop-daemon --start --quiet' $olsrd4init | tail -n1 | cut -d":" -f1)+5))
401
401
sed -i $linenumber'i\
402
402
if [ ! -f /etc/cron.d/olsrdwatchdog ] &&\
403
- [ -f /etc/default/olsrd ] && [ $(cat /etc/default/olsrd | cut -d "#" -f 1 | grep -c START_OLSRD=\"YES\") \\> 0 ] &&\
403
+ [ -f /etc/default/olsrd ] && [ $(cat /etc/default/olsrd | cut -d "#" -f 1 | grep -c '' START_OLSRD=\"YES\"'' ) \\> 0 ] &&\
404
404
[ $(cat /config/user-data/olsrd4.conf | cut -d "#" -f 1 | grep -c LoadPlugin.*olsrd_watchdog) \\> 0 ] &&\
405
405
[ -x /etc/olsrdwatchdog ] ; then\
406
406
echo "* * * * * root /etc/olsrdwatchdog >/dev/null 2>/dev/null" >/etc/cron.d/olsrdwatchdog\
410
410
#fix init.d/olsrd generating a "0" file
411
411
[ -f $olsrd4init ] && (grep -q ' > 0 ]' $olsrd4init) && sed -i 's/> 0 ]/\\> 0 ]/g' $olsrd4init
412
412
413
+ ## olsrdwatchgdog patch BEGIN
414
+ #patch syntax error in init file related to creation of watchdog cron.d entry
415
+ if (grep -q ' START_OLSRD="YES")' /etc/init.d/olsrd); then
416
+ sed -i "s/ START_OLSRD=\"YES\")/ 'START_OLSRD=\"YES\"')/g" /etc/init.d/olsrd | grep "START_OLSRD="
417
+ fi
418
+ #add cron entry if missing but expected to be there
419
+ if [ ! -f /etc/cron.d/olsrdwatchdog ] &&
420
+ [ -f $olsrd4default ] && [ $(cat $olsrd4default | cut -d "#" -f 1 | grep -c 'START_OLSRD=\"YES\"') \> 0 ] &&
421
+ [ $(cat $olsrd4config | cut -d "#" -f 1 | grep -c LoadPlugin.*olsrd_watchdog) \> 0 ] &&
422
+ [ -x /etc/olsrdwatchdog ] ; then
423
+ echo add watchdog to crontab >>$log
424
+ echo "* * * * * root /etc/olsrdwatchdog >/dev/null 2>/dev/null" >/etc/cron.d/olsrdwatchdog
425
+ chmod 644 /etc/cron.d/olsrdwatchdog
426
+ fi
427
+ ## olsrdwatchgdog patch END
428
+
413
429
## END patch for installing this wizard onto a existing 0.9.0.3 wizard END ##
414
430
#############################################################################
415
431
432
+
416
433
###update default intervals to reduce olsr management traffic
417
434
#define new settings
418
435
Pollrate="0.1"
@@ -19569,7 +19586,7 @@ UG=$(echo $(id -un):$(id -u) "("$(id -gn):$(id -g)")")' $olsrd4init
19569
19586
linenumber=$(($(grep -n 'start-stop-daemon --start --quiet' $olsrd4init | tail -n1 | cut -d":" -f1)+5))
19570
19587
sed -i $linenumber'i\
19571
19588
if [ ! -f /etc/cron.d/olsrdwatchdog ] &&\
19572
- [ -f /etc/default/olsrd ] && [ $(cat /etc/default/olsrd | cut -d "#" -f 1 | grep -c START_OLSRD=\"YES\") \\> 0 ] &&\
19589
+ [ -f /etc/default/olsrd ] && [ $(cat /etc/default/olsrd | cut -d "#" -f 1 | grep -c '' START_OLSRD=\"YES\"'' ) \\> 0 ] &&\
19573
19590
[ $(cat /config/user-data/olsrd4.conf | cut -d "#" -f 1 | grep -c LoadPlugin.*olsrd_watchdog) \\> 0 ] &&\
19574
19591
[ -x /etc/olsrdwatchdog ] ; then\
19575
19592
echo "* * * * * root /etc/olsrdwatchdog >/dev/null 2>/dev/null" >/etc/cron.d/olsrdwatchdog\
@@ -20111,7 +20128,7 @@ Interface "br9" {\
20111
20128
fi
20112
20129
#add cronjob? if missing, olsrd-autostart=on, executeable watchdogscript
20113
20130
if [ ! -f /etc/cron.d/olsrdwatchdog ] &&
20114
- [ -f $olsrd4default ] && [ $(cat $olsrd4default | cut -d "#" -f 1 | grep -c START_OLSRD=\"YES\") \> 0 ] &&
20131
+ [ -f $olsrd4default ] && [ $(cat $olsrd4default | cut -d "#" -f 1 | grep -c ' START_OLSRD=\"YES\"' ) \> 0 ] &&
20115
20132
[ $(cat $olsrd4config | cut -d "#" -f 1 | grep -c LoadPlugin.*olsrd_watchdog) \> 0 ] &&
20116
20133
[ -x /etc/olsrdwatchdog ] ; then
20117
20134
echo add watchdog to crontab >>$log
@@ -20120,7 +20137,7 @@ Interface "br9" {\
20120
20137
fi
20121
20138
#need to remove cronjob?
20122
20139
if [ ! -f $olsrd4default ] ||
20123
- [ $(cat $olsrd4default | cut -d "#" -f 1 | grep -c START_OLSRD=\"YES\") -eq 0 ] ||
20140
+ [ $(cat $olsrd4default | cut -d "#" -f 1 | grep -c ' START_OLSRD=\"YES\"' ) -eq 0 ] ||
20124
20141
[ $(cat $olsrd4config | cut -d "#" -f 1 | grep -c LoadPlugin.*olsrd_watchdog) -eq 0 ] ||
20125
20142
[ ! -x /etc/olsrdwatchdog ]; then
20126
20143
if [ -f /etc/cron.d/olsrdwatchdog ]; then
0 commit comments