[mythtv-users] mythbackend service not reliably closing via script

Robert Johnston anaerin at gmail.com
Mon Apr 4 18:41:30 UTC 2011


On 04/04/2011 1:31 AM, tim draper wrote:
> that was my issues on the first revision of the script; script runs as
> 'root', and called scripts from ~\scripts\yyy.sh.
> all paths are hardlinked now.
>
> i've found a work around; stop mythtv-backend service from ever running,
> and run 'mythbackend -d'.
> this way i can kill mythbackend by doing 'sudo killall mythbackend'
> reliably and so far it's been working fine. so far, it works as
> expected, although i suspect if the mythbackend stops for any reason i
> will need to re-launch it manually.
>
> i'm still interested to know why 'sudo service mythtv-backend [status]'
> freezes the script, as it works fine when ran manually, but I've found a
> working solution. could this be a bug in the way mythtv-backend is
> handled? other service commands work fine; it's specifically related to
> mythtv-backend service and being called from a script (Bash or SHell -
> cant remember which i've got set)
> unless their just alias', then the various other ways of changing
> service states i've tried are 'stop mythtv-backend' and something like
> '/etc/init.d/mythtv-backend stop', i've even tried the -q switch too
> incase it  had something todo with the text that is displayed.

You shouldn't use sudo in a batch script. If you don't have an auth 
token, sudo will stop execution and prompt to try and get one, which in 
a non-interactive shell script is very bad indeed. Remove the sudo, and 
run the script as root (with sudo) instead. This may be the cause of 
your problem: Sudo is waiting for a user to type in their password, 
which (if the script is running through cron, say, or STDOUT is 
redirected) won't happen, so the script appears to freeze.

Just a thought.



More information about the mythtv-users mailing list