LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   xset dmps force off doesn't work in cron (https://www.linuxquestions.org/questions/linux-desktop-74/xset-dmps-force-off-doesnt-work-in-cron-4175587024/)

howandsen 08-14-2016 04:26 AM

xset dmps force off doesn't work in cron
 
sleep 1
xset dpms force off

I add two lines above to the script, and manually run it, it works as I expected.
But when the script runs by cron, the "xset dpms force off" doesn't work.
anyone had an idea?

ondoho 08-14-2016 05:01 AM

afaik, cron does not use any environment variables.
so,
a) you need to use the full path to the executable
b) have to tell xset what $DISPLAY is set to
c) is cron running as root? might have to sudo to normal user.

edit:
in retrospect, this seems like an x-y-problem to me.
what are you really trying to accomplish here?

howandsen 08-14-2016 11:24 PM

Quote:

Originally Posted by ondoho (Post 5590622)
b) have to tell xset what $DISPLAY is set to

hi, ondoho,
Code:

DISPLAY=:0 xset dpms force off
works just fine. thank you so much!

ondoho 08-15-2016 01:07 PM

glad to be of help! :hattip:


All times are GMT -5. The time now is 09:22 AM.