LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 03-11-2010, 07:25 AM   #1
Shreerang Patwardhan
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Rep: Reputation: 0
How to execute a shell script from a simple html web page


Hey all,
I wish to execute a shell script once a button on my html page is clicked. How do I do this? Need help!!!


Thanx,
Shreerang Patwardhan.
 
Old 03-11-2010, 08:14 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
Is this script going to run on the web server or on your computer ?

If it's your computer then read this :
http://www.linuxquestions.org/questi...o-this-794459/

If it's going to run on the web server then look up cgi
 
Old 03-11-2010, 09:34 AM   #3
Shreerang Patwardhan
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Hey smoker,
Ok, firstly the script is going to run on my machine itself and secondly, I read the thread you have provided a link to. That thread is similar to mine, the only difference is that he is required to go to a web page, click on a link and then execute a script. What I need is- Click on a button and run a shell script!! Well and also more importantly, that thread does not provide a solution on how to execute a shell script from an html page......So my problem still exists!...Please suggest a solution.
 
Old 03-11-2010, 10:15 AM   #4
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
No, I will not help you to do that.
 
Old 03-11-2010, 10:20 AM   #5
Shreerang Patwardhan
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Hey smoker,
N why is dat??...Why cant u help me????
 
Old 03-11-2010, 10:45 AM   #6
kernelzack
LQ Newbie
 
Registered: Jun 2009
Distribution: Centos
Posts: 25

Rep: Reputation: 15
You would like the script to be executed on the web server, no?

I would research "CGI" if I were you. I'm sure this is not good practice or anything like that but as long as you know that here is what I would do. Write a simple perl CGI script. Fix your html page so when the user presses the button, the cgi script is run. Inside the CGI script you can put this one liner in there


system "/path/to/script";



If this isn't what you want, tell me what the bash script does.
 
Old 03-11-2010, 10:52 AM   #7
Shreerang Patwardhan
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Hey kernelzack,
Where would you suggest that I should look for CGI information? And I do not wish to use Perl...Is there any other way round this problem???
 
Old 03-11-2010, 12:12 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,709
Blog Entries: 54

Rep: Reputation: 2965Reputation: 2965Reputation: 2965Reputation: 2965Reputation: 2965Reputation: 2965Reputation: 2965Reputation: 2965Reputation: 2965Reputation: 2965Reputation: 2965
While BaSH isn't preferred for CGI it can be used: here's a simple example. Apart from a wee bit of scripting it's just basic HTML. Using CGI requires you run a webserver however. If Apache is too big or complex for your taste there's Tiny HTTPd, thttpd and other small webservers.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I execute a bash script from a link on a web page? Is there any way to do this digilifellc Linux - Desktop 6 03-11-2011 03:56 AM
How do I execute a bash script from a link on a web page? Is there any way to do this digilifellc Linux - Desktop 5 03-10-2010 12:24 PM
Linux Shell Script to GET an HTML page repeatedly with an Interval vxc69 Programming 5 05-08-2007 10:43 AM
Running a shell script from a web page anirbande Linux - Newbie 1 12-01-2006 02:36 PM


All times are GMT -5. The time now is 01:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration