LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-21-2012, 02:15 PM   #1
samoptimus@hotmail.com
LQ Newbie
 
Registered: Dec 2012
Posts: 1

Rep: Reputation: Disabled
execute a shell script from the html button


Hi all
the environment is Fedora 14 , Apache with PHP installed.

i am new to linux

may i ask i want to execute a shell script, but want to have a [run button] from html web page.



/root/start_mail.pl

/usr/bin/mutt -s "Test subject" -b samoptimus@gmail.com -- samoptimus@hotmail.com < /dev/null
/root/xxxxx.pl
/root/xxxxx2.pl


and i wish to have a web page (locate on the same Fedora) then have a button to run, the will execute /root/start_mail.pl , any one able to browse the web should able to exec it....

i try to refer cfajohnson 's instruction , however i am still failing....


thanks a lot.
 
Old 12-21-2012, 04:16 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,457
Blog Entries: 54

Rep: Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897
Quote:
Originally Posted by samoptimus@hotmail.com View Post
Hi all
Hello and welcome to LQ. Hope you like it here.


Quote:
Originally Posted by samoptimus@hotmail.com View Post
i am new to linux
The best way to learn to do things "the Linux way" is to read the documentation, ask questions and practice. However there are some things you should not do. I'll try to address them first.


Quote:
Originally Posted by samoptimus@hotmail.com View Post
the environment is Fedora 14 , Apache with PHP installed.
Current release is Fedora 17 with 18 around the bend. Fedora 14 is no longer supported and maintained: it receives no more bug fixes and security updates. First upgrade to 15, 16 and then 17 or install a distribution with a longer support cycle like for example CentOS. As a rule of thumb always ensure your OS and all software is up to date.


Quote:
Originally Posted by samoptimus@hotmail.com View Post
execute /root/start_mail.pl
/root is not a human user: it is chiefly for system maintenance only. The user the web server runs as will not and should not have access to /root directory contents. Do not change that and do not execute files in the /root directory.


Quote:
Originally Posted by samoptimus@hotmail.com View Post
Code:
/usr/bin/mutt -s "Test subject" -b samoptimus@gmail.com -- samoptimus@hotmail.com < /dev/null
Here you are implying that root sends this email. That is neither necessary or wanted: use an unprivileged account instead.


Quote:
Originally Posted by samoptimus@hotmail.com View Post
and i wish to have a web page (locate on the same Fedora) then have a button to run, the will execute /root/start_mail.pl , any one able to browse the web should able to exec it....
While BASH isn't preferred for CGI it can be used. Here's a simple example. Instead of "/usr/bin/vnstat" you'll be executing the script you wrote residing outside of the document root and outside of the /root directory (/usr/local/bin for example).
 
  


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
[SOLVED] Source or Execute an external Script from shell script helptonewbie Linux - Newbie 2 08-11-2010 12:48 PM
How to execute a shell script from a simple html web page Shreerang Patwardhan Linux - Software 7 03-11-2010 11:12 AM
help with execute mulitple shell script within shell script ufmale Programming 6 09-13-2008 12:21 AM
Execute a php or sql script by button click stranger_6_7 Linux - General 3 02-02-2007 08:24 PM
ColdFusion - Using a script to build and execute SQL query when a button is clicked Locura Programming 1 02-25-2004 09:59 PM


All times are GMT -5. The time now is 11:07 PM.

Main Menu
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