Start applications over the browser without connecting over telnet/ssh

'' This article based on work done by nix. Originally by mindbender. at Linkstationwiki.org ''

Starting (and stopping) an application via a LinkStation web interface involves a few simple steps. In general, one can use the existing web server thttpd which is typically running on the LS to provide the management API. The web server needs to provide ("serve") a web page which in turn provides start/stop buttons or links for one or more applications. When the buttons are pressed or the links are clicked, code on the LinkStation needs to execute the related Unix commands to start/stop a particular application.

The processing of the buttons is done via the web server's CGI interface. The web server calls related scripts via this interface. Typically, these scripts are written in Perl - but other scripting languages, or even binaries are possible.

There are many different ways to set up such a start/stop system. The following is a simple example. It provides a separate web page for an application. That web page is not integrated into the normal LinkStation web management GUI. The reason for this omission is simple. The web management GUI as delivered by Buffalo/Melco is very badly structured and difficult to extend. It is not impossible, but the amount of code which needs to be touched and changed in the original interface is huge for such a small change like adding another "menu" option to the ls web management GUI.

It should also be noted that the provided example makes little use of all the possibilities of the CGI interface. This is left as an excercise to the reader :-)

1) Create a Folder under /www where we put our startscript:

mkdir /www/cgi-bin3

'''2) change to new folder:+' (:note mldonkey-folder and why you change to it before staring mldonkey | this assumes that you have installed mldonkey to /mnt/mldonkey. if you are directly start mldonkey from another folder all configuration-files will be created there and mldonkey will run unconfigured:)

cd /www/cgi-bin3

'''3) Create a short start script for the app you want to start:

vi start_

and put into it the script:

#!/bin/sh

cd  ./

so for example if you want to start mldonkey:

#!/bin/sh

cd /mnt/mldonkey ./mlnet

4) before this script can be executed, you have to change the files permissions

chmod 755 start_mldonkey.cgi

Now you can test if the script works by pointing your browser to the following address:

http:///cgi-bin3/start_ .cgi

for mldonkey:

http:///cgi-bin3/start_mldonkey.cgi

5a) making a page with links and store them on the LS

If you have more than one app to start it isn't very comfortable to bookmark them all in your browser. So its time to create a html-page where all starting links are collected.

For example I have created /www/applaunch.html for mldonkey:

Linkstation AppLaunchPage StartMLdonkey! MLdonkey-Webinterface

5b) Making a page with buttons and store them on the LS

If you don't like links on your web page to start the application, you can use a button instead:

Linkstation AppLaunchPage   MLdonkey-Webinterface

6) change the permissions of the html-file so it can be accessed

chmod 644 /www/applaunch.html

without doing that you get an "403 Forbidden error"....

7) Test if the page can really be accessed:

Point your browser to:

http:///applaunch.html

and bookmark it if it works.

congratulations....now you can start your favorite app over your browser :)