I'm trying to create a link that will run a command (more specifically, open an ebook). Is there a way to do this?
3 Answers
Generally, you can run a command with cgi.
CGI-Scripts have to be in a specific folder that has to be defined in the apache configuration. like
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
then you can just create a bash script, put it there an execute it by calling in your browser.
eg. echo "Hello World" would write the output to your browser.
I'm not shure what you mean by "open an ebook", so if you give me more information about that I might be able to help you with this.
-
A CGI is what I was thinking of. I'm specifically trying to run "ebook-viewer %file".– ValleryApr 17, 2011 at 23:30
-
And what should that do? Show the ebook in your browser? show it somewhere else? just open it without showing it anywhere? I'm confused– sBlattApr 18, 2011 at 8:22
-
-
If you just link it, it should get opened in a pdf viewer in your browser... If you don't have any pdf-viewer locally you might want to use a ssh x tunnel– sBlattApr 24, 2011 at 19:13
You can have a local website (.html) with a link
<a href="http://localhost:12345"> start e-book </a>
And you need the portmapper running as a service (
sudo /etc/init.d/portmapper start
) in the background, and configure it, to start the ebook, if somebody tries to access port 12345. A bit complicated, as well as having a webserver running just for this task, but it is possible.
Another approach: Have a website with an Java applet, which starts a program. This might be not as easy, because of the sandbox and security restrictions, so you have to lern to sign applets yourself and so on.