Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 02-14-2005, 07:07 PM   #1
LQ Newbie
Registered: Feb 2005
Posts: 3

Rep: Reputation: 0
Call a shell script from php?

I have a shell script named "start" that starts a gameserver for me:


start=`date '+%H:%M on %d/%m/%y'`
echo "CoD UO Match server started @ $start" >>/usr/servers/coduomatch1/CoDUOMatch1.log
screen -A -m -d -S CoDUOMatch1 ./coduo_lnxded +set net_port 28965 +exec coduo_sd.cfg +set sv_cheats 0 +map_rotate +set fs_homepath /usr/servers/coduomatch1 +set fs_basepath /usr/servers/coduomatch1 >/dev/null 2>&1 &
echo $! >

I would like to make a simple web page with a button on it to call this script. I can't seem to find any info on how to do this using my usual search methods. Can someone point me in the right direction?
Old 02-14-2005, 07:14 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 5,393

Rep: Reputation: 409Reputation: 409Reputation: 409Reputation: 409Reputation: 409
I don't know if php will success with screen program, anyway try :

make a form with action="script.php"

And for script.php :
PHP Code:
Maybe edit your start script to give the full path to screen program in case
Old 02-15-2005, 01:51 AM   #3
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379

Rep: Reputation: 30
Use passthru() function it replaces both exec() and system(). It will execute shell script (or other program( and display raw output to your interface. Better read


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
Shell Script call API treotan Programming 1 08-22-2005 11:59 PM
call a c program in a shell script jagman Programming 4 04-05-2005 05:58 PM
call perl cgi script from php j-ray Programming 2 01-14-2005 09:23 AM
My shell script can't seem to call another script kakho Programming 3 04-17-2004 10:21 AM
Urgent: Call a C program through Linux shell script nuwandee Programming 14 04-10-2004 08:31 PM > Forums > Non-*NIX Forums > Programming

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

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