Forum

Full Version: Restart xbmc with script?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I recently installed retropie on Xbian. I need a script to possibly restart xbmc, without su permissions.

I will be launching this script via emulationstation and a keyboard will not be plugged in. I know xbmc can restarted with "sudo service xbmc start". But is there a way to do it without sudo? So I will not be prompted to type a password?

I am open to any idea's.
Terminal
xbian@xbian ~ $ cat xbres.sh
#!/bin/bash
service xbmc stop
service xbmc start
xbian@xbian ~ $ sudo cat /etc/sudoers | grep xbres
xbian ALL=(ALL) NOPASSWD: /home/xbian/xbres.sh
Just run "sudo /home/xbian/xbres.sh" and your XBMC will (re)start.
(7th Sep, 2013 03:46 PM)kraleksandr Wrote: [ -> ]
Terminal
xbian@xbian ~ $ cat xbres.sh
#!/bin/bash
service xbmc stop
service xbmc start
xbian@xbian ~ $ sudo cat /etc/sudoers | grep xbres
xbian ALL=(ALL) NOPASSWD: /home/xbian/xbres.sh
Just run "sudo /home/xbian/xbres.sh" and your XBMC will (re)start.
Thanks for that. Does the "service" command work for normal user's? I remember trying it I think as a normal user, and got command not found. Worked fine when I threw sudo in front of it. In any case, I will give this a test later. Thanks again.
(7th Sep, 2013 04:42 PM)Takenover83 Wrote: [ -> ]Thanks for that. Does the "service" command work for normal user's? I remember trying it I think as a normal user, and got command not found. Worked fine when I threw sudo in front of it.

The "service" command will need a password.
But please check the last 2 commands posted by kraleksandr:
Terminal
xbian@xbian ~ $ sudo cat /etc/sudoers | grep xbres
xbian ALL=(ALL) NOPASSWD: /home/xbian/xbres.sh

You can edit "/etc/sudoers" and allow your script to run without extra sudo command.
Thanks for clarifying. Just tested and it worked great.
However, one of the problems with retropie is that sometimes it doesn't want to start up correctly and will stay stuck at the logo screen. venge io taming io
Reference URL's