arevindh / pihole-speedtest

Pihole Speedtest Mod
https://arevindh.github.io/pihole-speedtest/
MIT License
216 stars 22 forks source link

Set specific time to run #33

Closed raidoo9 closed 4 years ago

raidoo9 commented 4 years ago

On schedule it gives you options, every 1 hour, every 2 hours etc.

Is there and option to set it to run at specific times, eg. 00:00 & 06:00

Thanks

arevindh commented 4 years ago

Just edit the crontab and change to whatever you like.

raidoo9 commented 4 years ago

Ok so in sudo crontab I have set

0 0 * sh "/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh" >> /logs/speedtest 2>&1

0 6 * sh "/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh" >> /logs/speedtest 2>&1

and ensure it is set to disable on the schedule settings page?

raidoo9 commented 4 years ago

When I try to run speedtest.sh:

speedtest.sh: 47: speedtest.sh: source: not found speedtest.sh: 59: speedtest.sh: [[: not found speedtest.sh: 65: speedtest.sh: Syntax error: "(" unexpected

Thanks

arevindh commented 4 years ago

Try this :

sudo crontab -e

0 0,6 * * * sudo "/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh" > /dev/null 2>&1

Generate crontab here : https://crontab-generator.org/ Enter sudo "/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh" in command column.

raidoo9 commented 4 years ago

Thanks, unfortunately still getting same errors as above. Happens as well I just just try to execute the script directly. Any idea what line 47, 59 and 65 in the .sh do or why I could be getting this error?

arevindh commented 4 years ago

Are you still using sh ? try using bash .

raidoo9 commented 4 years ago

Thanks!