To schedule an automatic browser refresh, you’ll need to create a script file and schedule it as a CRON job. The script uses xdotool to send an F5 keypress which refreshes the browser window. There are some gottchas that are easily missed.
The file should contain the following:
#! /bin/bash
export XAUTHORITY=/home/pi/.Xauthority
export DISPLAY=:0
xdotool search –onlyvisible –class chromium windowfocus key F5
Note: depending on browser the doubledash may appear as a single long dash.
I named it refresh.sh then use chmod u+x filename to make it executable and chown to make sure it’s owned by pi and not root for execution.
If you’re not sure which the Xauthority file is being used, just run ‘xauth’ on the command line and it will tell you.
The name of the class is important. If you are using chromium, you have to say chromium; chrome finds chrome browsers not chromium browsers.
To schedule the job for every 5 minutes use:
crontab -e
*/5 * * * * /home/pi/refresh.sh >/dev/null 2>&1
The job sends an email every time it runs. The dev/null sends it to the bit bucket instead of filling up your mail inbox.
To check if the job has run:
cat /var/log/syslog | grep refresh.sh
To list and print all crontabs on the box:
must be root to work
this will list all users in the passwd file including mail, games, sys, sync and so on down the list
sudo su
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done