scripts: Redirect cron output to log only

This prevents information sent via e-mail.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2018-05-30 12:28:51 +02:00
parent cf3517d9d2
commit 339eaee9a5
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
command="systemctl restart uwsgi-tiles" command="systemctl restart uwsgi-tiles"
append="2>&1 | /usr/bin/logger -t uwsgi-tiles"
if crontab -l | grep -q "$command" ; then if crontab -l | grep -q "$command" ; then
echo "Cron already set." echo "Cron already set."
@ -8,7 +9,7 @@ if crontab -l | grep -q "$command" ; then
fi fi
# Runs at X:14 # Runs at X:14
(crontab -l 2>/dev/null; echo "14 * * * * $command") | crontab - (crontab -l 2>/dev/null; echo "14 * * * * $command $append") | crontab -
echo "Cron set successfully." echo "Cron set successfully."
exit 0 exit 0

View File

@ -8,10 +8,10 @@ if crontab -l | grep -q "$monpath" ; then
fi fi
# Runs every 5 min and waits 3 min # Runs every 5 min and waits 3 min
(crontab -l 2>/dev/null; echo "3-59/5 * * * * $monpath/scripts/calcglobalstats.py") | crontab - (crontab -l 2>/dev/null; echo "3-59/5 * * * * $monpath/scripts/calcglobalstats.py 2>&1 | /usr/bin/logger -t calcglobalstats") | crontab -
# Runs at 4:02 # Runs at 4:02
(crontab -l 2>/dev/null; echo "2 4 * * * $monpath/scripts/deletestats.py") | crontab - (crontab -l 2>/dev/null; echo "2 4 * * * $monpath/scripts/deletestats.py 2>&1 | /usr/bin/logger -t deletestats") | crontab -
echo "Cron set successfully." echo "Cron set successfully."
exit 0 exit 0