[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    Re: xrandr weird issue running from a script
From:       Łukasz Maśko <ed () yen ! ipipan ! waw ! pl>
Date:       2016-11-08 23:26:12
Message-ID: 2797362.f20BVDS24f () laptok
[Download RAW message or body]

Dnia wtorek, 8 listopada 2016 14:19:08 Ratin pisze:
> I am testing this simple script, calling it from php via apache web server.
> But anything to do with xrandr is simply omitted by the scipt while
> everything else include system calls like reboot etc works fine. Initially
> I thought its because the DISPLAY env variable issue but it gets the
> variable correctly in the logs, so now I am totally baffled.
> 
> #! /bin/bash
> 
> #export DISPLAY=:0
> export Dis=$(echo $DISPLAY)
> echo "Display: $Dis" > /var/log/updateDDInfo.log
> 
> checkHDMI=`sudo /usr/bin/xrandr| grep -i "HDMI1.*\ connected"`
> checkDP=`sudo /usr/bin/xrandr --display :0| grep -i "DP1.*\ connected"`
> echo "p.sh: HDMI Check: $checkHDMI " > /var/log/updateDDInfo.log
> echo "p.sh: DP Check: $checkDP " > /var/log/updateDDInfo.log
> 
> 
> If I run from command prompt I get the usual response:
> "p.sh: DP Check: DP1 connected 3840x2160+1920+0 (normal left inverted right
> x axis y axis) 607mm x 345mm"
> 
> Anybody has any clue?

Probably the problem is with X authorization, DISPLAY variable is not enough. 
In my scripts I do something like this:

export XAUTHORITY=/home/users/$USER/.Xauthority
export DISPLAY=:0
export QT_X11_NO_MITSHM=1 # don't now if xrandr needs this, probably not

and then xrandr and other commands work. But these are bash scripts. You have 
to probaby do something similar.
-- 
Łukasz Maśko                                                            _o)
Lukasz.Masko(at)ipipan.waw.pl                                           /\\
Registered Linux User #61028                                           _\_V
Ubuntu: staroafrykańskie słowo oznaczające "Nie umiem zainstalować Debiana"

_______________________________________________
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic