Scheduling caffeine
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Caffeine |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I need to be able to prevent sleep during certain hours of the day, so that my Plex media player can work.
However:
1) caffeine doesn't support any clock-based scheduling options.
2) activating for a time period on Cron (e.g. 9am cronjob to caffeinate for 12 hours) doesn't seem to work, something inside Caffeine seems to be silently failing and the process doesn't stick. My Cron command is...
/usr/bin/caffeinate /usr/bin/sleep 13h &
I think if you can fix '2', you don't need to support '1'. But I've tried logging stdio and stderr to a file during Cron to see what's happening, and it's blank -- and nothing is inside my syslog except confirmation of the Cron command running without errors.
From personal experience I know Cron scripts can be problematic due to different environment variables and no PATH setting. Perhaps this is the cause.
description: | updated |
I suspect the problem is with caffeine getting access to the X server, though I'm a bit surprised that in that case it doesn't give an error. Have you tried setting `DISPLAY=:0` in your cron job's environment? See e.g. https:/ /askubuntu. com/questions/ 471479/ cannot- run-a-gui- app-from- cron