LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-29-2008, 08:00 PM   #1
bassamh
LQ Newbie
 
Registered: Jun 2006
Posts: 1

Rep: Reputation: 0
Question Q: Run a sh script in httpdoc


Hello, first I thank anyone who try to get me up of this Q.



I have a script to start/stop a prog ( /usr/bin/Pro.d1) this script locate in /var/script1.sh.

Code:
 #!/bin/sh
PRONAME="MyPro" 

start_pro ()
{
/usr/bin/Pro.d1 &
sleep 2
}
# This method stops MyPro
stop_pro ()
{
killall Pro.d1
}
case "$1" in
start)
echo "[SCRIPT] $1: $PRONAME"
start_pro
;;
stop)
echo "[SCRIPT] $1: $PRONAME"
stop_pro
;;
restart)
echo "Restaring $PRONAME"
stop_pro
start_pro
;;
*)
"$0" stop
exit 1
;;
esac
exit 0

what I want is a PHP file (eg: index.php) that will execute the /var/script1.sh

I try one :

Code:
<?php 
$return = exec("/var/script1.sh"); 
echo "Executing Status: $return"; 
?>
but Unfortunately the file wouldn't run or maybe the exec() was disabled.

Any ideas

Thanks
 
Old 01-30-2008, 02:26 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi,

And welcome to LQ!

The first suggestion would be to enable debug output for PHP to
find out what happens?


Cheers,
Tink

P.S.: Moving this thread over to programming where it is more suitable....
 
  


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
Is a script, run at boot time from init.d, run with root authority? tmbrwolf53 Linux - Server 2 03-31-2007 08:15 PM
how to run a shell script in the perl script sharad Linux - General 1 05-24-2006 03:23 AM
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM
Script to run script in multiple directories... seabass55 Linux - General 5 07-06-2004 12:44 AM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 09:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:32 PM.

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
Open Source Consulting | Domain Registration