views:

273

answers:

3

Sometimes my media server does not update its database, the only way to fix it is to restart the daemon.

I would like users to be able to simply run an executable or script to do so without revealing any login information to them (which might result in inadvertent headaches).

I feel the easiest way to do this would be to have an executable/script located on a samba share which they can run. The users would be running Windows or Macs which are all on the same local network as the server.

+1  A: 

Write up a small CGI script or web app that has a button that when pushed restarts the daemon.

Ignacio Vazquez-Abrams
Is there any way to do that without setting up apache?
Absolutely. There are a number of very simple, lightweight HTTP servers available, or you could even use something like `BaseHTTPServer`. http://docs.python.org/library/basehttpserver.html
Ignacio Vazquez-Abrams
Whats the best way to restart a service from a CGI shell script? I cannot do "sudo /etc/init.d/ restart". I am currently using CGIHTTPServer in python for the webserver and it runs as user nobody. By the way this is supposed to be for local users only.
I wouldn't run it as a CGI script if I had the option. I would have it run as the same user as the daemon, as a HTTP server itself.
Ignacio Vazquez-Abrams
Yea I came to the same conclusion after tinkering with CGI scripts... Im thinking of just running the BaseHTTPServer as a daemon and restarting it from within that program itself when its accessed and it will just display a status page. Thanks.
A: 

You just need some communication between a privileged daemon (or frequent cron) and the CGI script. Have the CGI script create a file, if the daemon or cron finds it have it restart the service and unlink the file. Primitive, but effective.

As Ignacio said, there are many, many lightweight HTTP servers that support CGI.

Tim Post
A: 

I would love to be able to restart some Linux service for a other linux box or windows box. I don't want to restart the server because its running open vpn.

John Jones www.tsintegrator.com

John Jones