简体   繁体   中英

Why is cron is not running xte?

I am attempting to reload Iceweasel from a cron job. I can run the following from the command line; it successfully reloads the page in Iceweasel:

 xte -x :0 "key F5"

I need this refresh to happen every 5 minutes. So, I set up the following as a root user cron job; this one does not work:

 */5 * * * * xte -x :0 "key F5"

I also tried including the full path to xte

*/5 * * * * /usr/bin/xte -x :0 "key F5"

Does anyone know the solution?

I found that cron needs the user creds in order to run. I am running this crontab on a Raspberry Pi set up as a Kiosk. So, the logged-in user is "Pi"

here is what works for me:

 */5 * * * * DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/xte "key F5"

I hope this helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM