SunQuest
           UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old February 28th, 2005, 09:10 AM
MueR's Avatar
MueR MueR is offline
Weirdo ™
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2004
Location: /dev/null
Posts: 662 MueR User rank is Sergeant (500 - 2000 Reputation Level)MueR User rank is Sergeant (500 - 2000 Reputation Level)MueR User rank is Sergeant (500 - 2000 Reputation Level)MueR User rank is Sergeant (500 - 2000 Reputation Level)MueR User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 21 h 1 m 57 sec
Reputation Power: 12
Starting/stopping gameservers

Hello all,
I've posted something about this in the PHP forum too, but I'll post here aswell, since I was advised to do so.
I've started working on a webbased control panel for gameservers. Really simple, just starting, stopping and restarting them. All the user has to do is click the right button. All the script has to do, is pass either START, STOP or RESTART to a script called codstarter (since I am testing this on an unused call of duty server install).

I am using PHP's built in system() command, which allows to execute system commands. The command I'm using now is like this:
PHP Code:
 $script_dir "/home/ftd2/cod";
system("su ftd2 ; cd $script_dir ; ./codstarter ".$_POST['argument'],$retVal); 

According to PHP's documentation, anything returned by the system should be placed in $retVal. However, $retVal always is 0.

Would anyone know how to get the script working?
__________________
Boss: "We found a bug in your code!"
Programmer: "That's no bug, that's just an undocumented feature!"

is a nice way to show appreciation if my suggestion was helpful.

Scriptrequests are not appreciated anywhere. Show input. Do some research. Explain the problem. Post relevant code only.

Reply With Quote
  #2  
Old February 28th, 2005, 10:45 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 44 m 45 sec
Reputation Power: 9
i assume you are on *nix

your
$script_dir = "/home/ftd2/cod";
Quote:
system("su ftd2 ; cd $script_dir ; ./codstarter ".$_POST['argument'],$retVal);

will not work as long YOU ARE NOT ROOT, because 'su' (in this case) is INTERACTIVE
and expect a passwd
btw: why that 'cd', why not simply $script_dir/codstarter .....
look¦google for 'SSH' or 'sudo'
__________________
working on Solaris[5-9], preferred languages french and C.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Starting/stopping gameservers


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway