Skip to content

Commit

Permalink
check and remove duplicate cron service runner entry
Browse files Browse the repository at this point in the history
  • Loading branch information
glynhudson committed May 9, 2016
1 parent 5e1c940 commit 3272b92
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions emoncmsupdate
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,12 @@ else
echo "service runner crontab entry already installed"
fi
sudo rm mycron

# Check if double service runner (with space) entry exits, if so remove it
crontab -l > mycron
if grep -Fxq " * * * * * /home/pi/emonpi/service-runner >> /var/log/service-runner.log 2>&1" mycron ; then
echo "Remove duplicate service runner entry"
sed -i "/\s\* \* \* \* \* \/home\/pi\/emonpi\/service-runner >> \/var\/log\/service-runner.log 2>&1/d" ./mycron
crontab mycron
sudo rm mycron
fi

0 comments on commit 3272b92

Please sign in to comment.