LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 08-14-2016, 04:26 AM   #1
howandsen
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Rep: Reputation: Disabled
Question 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?
 
Old 08-14-2016, 05:01 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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?

Last edited by ondoho; 08-14-2016 at 05:03 AM.
 
1 members found this post helpful.
Old 08-14-2016, 11:24 PM   #3
howandsen
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
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!
 
Old 08-15-2016, 01:07 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
glad to be of help!
 
  


Reply

Tags
bash, shell, xset



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] [cron] Root cron ib centos 6.3 doesn't work/ killout Linux - Newbie 2 12-17-2012 01:26 PM
[SOLVED] How to make xset dpms force off work with gnome-power-manager nokangaroo Linux - Software 6 05-18-2011 04:23 AM
My Cron Job Doesn't Work carlosinfl Linux - Server 8 06-07-2010 09:50 PM
xset dpms force on lowers my backlight redjokerx Linux - Laptop and Netbook 1 11-13-2007 10:55 PM
xset dpms force off does'nt turn off screen anirudh.iitm Linux - General 3 02-24-2007 01:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 11:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration