mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-23 15:50:19 +00:00
Fix for multiple crontab multiple entries
This commit is contained in:
parent
8a7479e9b6
commit
92d1386af7
1 changed files with 6 additions and 7 deletions
|
@ -477,15 +477,14 @@ SpeedtestMode(){
|
||||||
SetCronTab()
|
SetCronTab()
|
||||||
{
|
{
|
||||||
# Remove OLD
|
# Remove OLD
|
||||||
crontab -l >crontab.tmp
|
crontab -l > crontab.tmp
|
||||||
old=$(cat crontab.tmp | awk '/speedtest/ {print FNR}')
|
|
||||||
if [[ "$old" =~ ^[0-9]+$ ]]; then
|
|
||||||
crontab -l | sed -e "${old}d" >crontab.tmp
|
|
||||||
fi
|
|
||||||
# Add New
|
|
||||||
if [[ "$1" == "0" ]]; then
|
if [[ "$1" == "0" ]]; then
|
||||||
|
sed -i '/speedtest/d' crontab.tmp
|
||||||
crontab crontab.tmp && rm -f crontab.tmp
|
crontab crontab.tmp && rm -f crontab.tmp
|
||||||
else
|
else
|
||||||
|
sed -i '/speedtest/d' crontab.tmp
|
||||||
|
|
||||||
mode=$(sed -n -e '/SPEEDTEST_MODE/ s/.*\= *//p' $setupVars)
|
mode=$(sed -n -e '/SPEEDTEST_MODE/ s/.*\= *//p' $setupVars)
|
||||||
|
|
||||||
if [[ "$mode" =~ "official" ]]; then
|
if [[ "$mode" =~ "official" ]]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue