<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 4, 2020 at 6:34 PM Stephen Worthington <<a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, 4 Mar 2020 10:23:57 -0800, you wrote:<br>
<br>
>><br>
>> I just put those 2 (with some extra checking) eg:<br>
>>><br>
>><br>
>> #!/bin/bash<br>
>> while true ; do<br>
>> systemctl isolate multi-user.target<br>
>> if [ $? -eq 0 ]; then<br>
>> systemctl isolate graphical.target<br>
>> exit 0<br>
>> fi<br>
>> sleep 1<br>
>> done<br>
>><br>
>> (something along those lines - untested)<br>
>> Put in a script and call the script from irexec<br>
>><br>
>><br>
>><br>
>>> Allen<br>
>>><br>
>>> _______________________________________________<br>
>><br>
>><br>
>I tested the script suggested and found two problems.<br>
>1) I need to call my script with sudo. I don't know how to do that but if<br>
>it works on the next myth lockup I assume I can figure it out or ask for<br>
>help.<br>
>2) I had to change one line so the script is now<br>
>#!/bin/bash<br>
> while [ true ]; do<br>
> systemctl isolate multi-user.target<br>
> if [ $? -eq 0 ]; then<br>
> systemctl isolate graphical.target<br>
> exit 0<br>
> fi<br>
> sleep 1<br>
> done<br>
><br>
>I obviously cannot test it from the local terminal but it works fine from<br>
>my desktop upstairs. My plan is to try this the next time that myth hangs<br>
>up so I can confirm that it works under the actual locked conditions. My<br>
>fear is that it is the video card itself that is hung and that this will<br>
>not clear it.<br>
><br>
>Putting it in a button should be easy but not sure about the permissions<br>
>part.<br>
><br>
>Allen<br>
<br>
Any script or program can be set up in the /etc/sudoers file (or<br>
better in /etc/sudoers.d) to be able to be run with sudo without<br>
asking for a password. If you still want proper security, you need to<br>
make sure that anyone who can run the script is unable to modify it,<br>
so write permission should be set to root only. I do this for my<br>
mythtv-systemctl-helper.sh file that is run from mythfrontend to shut<br>
down or restart the system.<br>
<br>
See this post for full details:<br>
<br>
<a href="https://lists.gt.net/mythtv/users/625993" rel="noreferrer" target="_blank">https://lists.gt.net/mythtv/users/625993</a><br>
_______________________________________________<br></blockquote><div><br></div><div>Thank you for this. I have modified my killgui.sh file to add sudo</div><div><br></div><b>#!/bin/bash<br> while [ true ]; do<br> sudo systemctl isolate multi-user.target<br> if [ $? -eq 0 ]; then<br> sudo systemctl isolate graphical.target<br> exit 0<br> fi<br> sleep 1<br> done</b></div><div class="gmail_quote"><b><br></b></div><div class="gmail_quote">I created a test file that will only run with root permissions and put it in /etc/sudoers.d/ and changed the permissions and it runs.</div><div class="gmail_quote"><b>chown root:mythtv</b></div><div class="gmail_quote"><b>chmod ug=rx,o=</b><br><div> </div><div>My plan is to wait until I have a real lockup and run the file manually. When that test is successful, I will modify<b> /home/dad/.mythtv/lircrc</b> like this</div><div><b><br></b></div><div><b>config = /etc/sudoers.d/killgui.sh &</b><br></div><div><br></div><div>Hopefully I have this all correct. Please let me know if I screwed anything up :-)</div><div><br></div><div>Allen</div><div><br></div><div><br></div></div></div>