I'm wondering if a script could be written where I could have it run on my Mac Mini via cron or launchd to first check to see if MC is running on my QNAP NAS and if it times out, to run the command that Bob discovered?
Would this be possible?
I think it'd be easier to run one via the cron function on the QNAP itself but I think you should be able to do it either way.
The key is to check to see if it's already running. On standard linux distros one can use the command
pidof to get the process Id of mediacenter22. If it's not running the command above could be used to start it. The only other thing is there needs to be a way to find out if the X server is running on the QNAP (the user is logged in).
It gets a bit more complex if you don't want MC running on the QNAP all of the time but it's still doable. One way would be to create a simple 0 byte file with the
touch command on the QNAP to indicate whether the cron script should be starting up the mediacenter (or restarting it in case it closes) or shutting it down.
You could then use you mac to just create or delete that file and the cron script on the QNAP would do the rest. You might be able to get it to run without a password from a command line script on the Mac by using a authenticated login using a ssh key instead of the usual admin login procedure.