<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Il 14/12/2013 12:55, Dridi Boukelmoune
ha scritto:<br>
</div>
<blockquote
cite="mid:CAJYncsgbtk3uheKBhXh5QvfUh6FaJnaHj1+Az_Xs=7NEeCY=Tw@mail.gmail.com"
type="cite">
<pre wrap="">Hi,
On Sat, Dec 14, 2013 at 12:44 PM, Mattia Verga <a class="moz-txt-link-rfc2396E" href="mailto:mattia.verga@tiscali.it"><mattia.verga@tiscali.it></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hello,
I'm trying to give a user access rights to X with xhost command.
I've created a script named '/usr/bin/boincxhost' (chmod 555) like this:
#!/bin/sh
xhost +SI:localuser:boinc &> /dev/null
exit 0
</pre>
</blockquote>
<pre wrap="">"exit 0" will hide a non-zero exit status of the previous command.
In this case I'm not sure what's happening, but if you're running the
command in background, and don't wait for it to complete, you may be
facing a race condition.
</pre>
</blockquote>
<br>
Ok, I tried to edit the boincxhost script in this way:<br>
<br>
<font face="monospace">#!/bin/sh<br>
xhost +SI:localuser:boinc<br>
sleep 1</font><br>
<br>
Now if I run the script from console I get:<br>
<font face="monospace">$ /usr/bin/boincxhost <br>
localuser:boinc being added to access control list<br>
<br>
$ xhost <br>
access control enabled, only authorized clients can connect<br>
SI:localuser:boinc<br>
SI:localuser:marvin</font><br>
<br>
But if I run it within systemd unit the service is started, but
xhost command "silently" fails:<br>
<font face="monospace"># systemctl start boinc-client.service<br>
# systemctl status boinc-client.service<br>
boinc-client.service - Berkeley Open Infrastructure Network
Computing Client<br>
Loaded: loaded (/usr/lib/systemd/system/boinc-client.service;
disabled)<br>
Active: active (running) since sab 2013-12-14 14:52:25 CET; 4s
ago<br>
Process: 2843 ExecStopPost=/bin/rm -f /var/lib/boinc/lockfile
(code=exited, status=0/SUCCESS)<br>
<b>Process: 2947 ExecStartPre=/usr/bin/boincxhost (code=exited,
status=0/SUCCESS)</b><br>
Process: 2944 ExecStartPre=/usr/bin/chown boinc:boinc
/var/log/boinc.log /var/log/boincerr.log (code=exited,
status=0/SUCCESS)<br>
Process: 2941 ExecStartPre=/usr/bin/touch /var/log/boinc.log
/var/log/boincerr.log (code=exited, status=0/SUCCESS)<br>
Process: 2938 ExecStartPre=/bin/sleep 1 (code=exited,
status=0/SUCCESS)<br>
Main PID: 2952 (boinc)<br>
CGroup: name=systemd:/system/boinc-client.service<br>
├─2952 /bin/bash /usr/bin/boinc --dir /var/lib/boinc<br>
└─2953 /usr/bin/boinc_client --allow_multiple_clients
--dir /var/l...<br>
<br>
dic 14 14:52:23 deneb systemd[1]: Starting Berkeley Open
Infrastructure Net.....<br>
<b>dic 14 14:52:24 deneb boincxhost[2947]: xhost: unable to open
display ""</b><br>
dic 14 14:52:25 deneb systemd[1]: Started Berkeley Open
Infrastructure Netw...t.<br>
<br>
# xhost<br>
access control enabled, only authorized clients can connect<br>
SI:localuser:marvin</font><br>
<br>
<br>
</body>
</html>