<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2015-08-07 14:06 GMT+02:00 Nils Kassube <span dir="ltr"><<a href="mailto:kassube@gmx.net" target="_blank">kassube@gmx.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Johnny Rosenberg wrote:<br>
> 2015-08-07 10:43 GMT+02:00 Nils Kassube <<a href="mailto:kassube@gmx.net">kassube@gmx.net</a>>:<br>
> > Johnny Rosenberg wrote:<br>
> > > My script has another bug that will happen if there is more than<br>
> > > one<br>
> > > folder in ”/run/user”. That can happen and it happened when I<br>
> > > switched user to my wife's account. For a moment there was a<br>
> > > directory called ”112”, which is ”lightdm” and it messed up my log<br>
> > > file a bit.<br>
> ><br>
> > An easy way to find the (hopefully) correct path would be to use<br>
> > "/run/user/$UID". As I understand it, your final path should be<br>
> > "/run/user/$UID/gvfs/mtp:host=%5Busb%3A001%2C011%5D". If you even<br>
> > want to avoid the $UID, you could even use<br>
> > "/run/user/*/gvfs/mtp:host=%5Busb%3A001%2C011%5D".<br>
><br>
> No, the script is run from the system, so there is no UID or any<br>
> environment variables at all except those related to Udev.<br>
<br>
</span>Silly me - of course there is no useful UID for a script run by udev.<br>
Thinking about it, you may have a problem if there are several users<br>
active at the same time. Then there should be several directories in<br>
/run/user and I don't think you have a way to decide for which user you<br>
should make the device available.<br>
<span class=""><br>
> The ”/run/user/*/gvfs…” thing is however something that I didn't think<br>
> of. I'll experiment a bit with it.<br>
<br>
</span>Hmm, I think that idea wasn't useful either. After all the path does not<br>
yet exist, so the wildcard doesn't help here.<br></blockquote><div><br></div><div>Well, I noticed that the path doesn't exist until the script is completely executed, BUT I work around that by having a script that starts another one in the background. The starter script will then finish very quickly, then the path will exist and the script that now is running in the background only has to search for it until it finds it. Unfortunately my if statement that tests if the path exists gives false even if true, and that's what bothers me at the moment. The loop gets eternal, but while it's running I can verify that the path exists, still the script doesn't come out of the loop.</div><div><br></div><div><br></div><div>Johnny Rosenberg</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
Nils<br>
<br>
<br>
--<br>
ubuntu-users mailing list<br>
<a href="mailto:ubuntu-users@lists.ubuntu.com">ubuntu-users@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-users" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-users</a><br>
</div></div></blockquote></div><br></div></div>