[mythtv-users] OT: Need to log out of console or restart X via script

mythtv-users at fastdruid.co.uk mythtv-users at fastdruid.co.uk
Sat Dec 10 14:01:14 EST 2005

On Saturday 10 December 2005 18:15, Rob Bongiovi wrote:
> Hi! I'm not very experienced in Linux and need some
> help with something.
> But, I can't figure out either without quickly getting
> confused. If someone could help me, I'd appreciate it.
> Here's what I want to do:
> #First kill any mythfrontend process that is running
> sudo killall mythfrontend
> #<insert logout or restart X command here>
> sudo mythfrontend -l /var/log/mythtv/mythfrontend.log
> &

Firstly ISTR Jarod has a section with a 'restart' script and how to link it to 
your remote, base a script on that.

The exact syntax depends on your distro but there is a rc script that starts 
(or stops X), it's called xdm (on suse anyway), call that with restart and 
it'll kill X and then restart it.
ISTR fedora has a program/script called service which allows you to run rc 
scripts, suse has links from them in /sbin or /usr/sbin (for 
example /usr/sbin/rcxdm -> /etc/init.d/xdm), other distros may have something 
different or nothing at all (you have to call the script directly).
I'm assuming you're using fedora and going for /sbin/service (at least I 
_think_ it's in /sbin ;-)  )

Create a little script something like:

sudo killall mythfrontend
sudo /sbin/service xdm restart

(obviously check it'll work from a ssh/console session first)

If you need to load/unload things (for example if your driver is buggy) go for 
something like (obviously 'a-framebuffer-module' should be replaced by the 
module you need to reload):

sudo killall mythfrontend
sudo /sbin/service xdm stop
sudo rmmod a-framebuffer-module
sudo modprobe a-framebuffer-module
sudo /sbin/service xdm start

Obviously you'd have to have mythfrontend start automatically and have auto 
login but I presume you have that already.



More information about the mythtv-users mailing list