There had to be a way to do simple commands for linux without going to the command line. The neat part to this project is that you can so easily expand it yourself. Need a directory listing. No problem. Need to know how the disk space is doing. No problem. This simple project will probably expand to a whole management system eventually. But in the mean time, here is just the basic structure which you can easily expand on. Also see https://www.instructables.com/id/Web-page-scraping-fromto-a-web-page/

Note: if you are on a terminal that does not have a terminal client, this project is a real lifesaver. This project makes it real easy for me to use a touchpad and check on my servers. No special client software necessary. Also this could be very easily adapted for the Apple Macintosh systems also since it is allegedly bsd based (a cousin of linux). Yes, control your "Mac" from a web page.

If you like this instructable, you might like this one also: https://www.instructables.com/id/Linux-screen-play/

Installed Arch linux on a pogoplug v2 and that is a wee bit different to set up the cgi-bin.

Step 1: What's needed:

Human with a basic understanding of BASH (Bourne again shell).

Computer running Apache or other web server that supports the CGI (Common gateway interface).
  A Lamp (linux, apache, mysql, and php) server would be a good start.

<p>good post, thanks for sharing with us. we too working on Linux for implementing new projects. We frequently browse internet for hot topics in Linux. We found this post good.</p>
<p>Thank you for your reply..</p>
<p>Followed all instructions to the letter, when I place &quot;bash.cgi&quot; into /var/www/cgi-bin and try to access it via I get Internal server Error 500. 0.o I'm on Fedora 20 with the httpd package from YUM.</p>
<p>Ok I fixed this issue, now instead, when I go to the address, it tried to download the bash.cgi file, I think it's an error in the script itself, because when I try just &quot;<br>#!/bin/sh<br>echo &quot;Content-type: text/html\n&quot;<br>echo<br>echo &quot;Testing...&quot;<br>it works fine. </p>
<p>Fixed this one on my own again.<br>Change the very first echo line to<br>echo -e &quot;Content-type: text/html\n&quot;<br><br>Worked like a charm.</p>
<p>Interesting. never had to do that.</p>
<p>My setup still works fine.</p>
<p>You have to set up a directory specifically for doing the cgi bin and tell the web server configuration about it. The normal cgi-bin is not normally in /var/www. With apache 2.4 configuration files have changed, I have not had a chance to look at it yet, but a lot of things have changed.By the way I do not use the localhost address, I use the normal ipaddress. </p><p>In /etc/apache2/sites-available/000-default.conf</p><p>#ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/<br> ScriptAlias /cgi-bin/ /var/www/cgi-bin/<br># &lt;Directory &quot;/usr/lib/cgi-bin&quot;&gt;<br><br> &lt;Directory &quot;/var/www/cgi-bin&quot;&gt;<br> AllowOverride None<br> Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch<br> Order allow,deny<br> Allow from all<br> &lt;/Directory&gt;</p>
<p>Can use this for openwrt? I can control GPIO of router via ssh command, but i can not create web interface.</p><p>https://forum.openwrt.org/viewtopic.php?id=54555</p>
<p>openwrt and luci has a cgi bin dir. You will need to install luci if you have not already done so. Embed your gpio command in the cgi script.</p><p>There <strong>must</strong> be a blank line between the HTTP header and the body. Also, you might want to serve up a complete html document.</p><pre><code>#!/bin/sh <br>echo &quot;Content-type: text/html&quot; <br>echo <br>echo &quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;hello world&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;It works!&lt;/p&gt;&lt;/body&gt;&quot; </code></pre>
<p>Can use this for openwrt? I can control GPIO of router via ssh command, but i can not create web interface.</p><p>https://forum.openwrt.org/viewtopic.php?id=54555</p>
<p>I don't have access to /var/www/cgi-bin/ when I try to access it through my browser and when I place the file elsewhere, it displays it as plain text. How can I fix this?</p>
<p>I know I responded to this. replay was missing. You need to make sure that the .txt extention is not used. secondly, you need to make sure the cgi is set up right. Do not know your setup, so it is hard to suggest anything. Also check your permissions.</p><p>-rwxr-xr-x 1 www-data www-data 3729 Jun 2 14:53 bashcgi1.cgi</p>
<p>Do not know which server you are using. You will want to go and check your cgi is installed correctly with correct permissions. Hint: look at the apache.conf file.</p>

About This Instructable




Bio: computoman.blogspot.com Bytesize articles instead of a trilogy in one post.
More by Computothought:Coffeepot meals Easy sun hat Easy cakes and pies. 
Add instructable to: