LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-12-2006, 04:38 AM   #16
doc.nice
Member
 
Registered: Oct 2004
Location: Germany
Distribution: Debian
Posts: 274

Rep: Reputation: 34

Quote:
/srv/www/htdocs/restart.php
Code:
? system("./restart.sh"); ?>
<html>
<body>You have now restarted the server.</body>
</html>
the first line should start with <?php

about your screen problem i can't help you, as i don't use screen, someone else?
 
Old 09-13-2006, 10:46 AM   #17
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by doc.nice
the first line should start with <?php

about your screen problem i can't help you, as i don't use screen, someone else?
same error im afraid i use apache webserver if that helps
 
Old 09-13-2006, 12:47 PM   #18
doc.nice
Member
 
Registered: Oct 2004
Location: Germany
Distribution: Debian
Posts: 274

Rep: Reputation: 34
sorry, I'm out...
 
Old 09-14-2006, 02:24 AM   #19
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
Firstly, this code says something to the effect of "specify command":
Code:
screen -S css-server -X quit
screen -S stats -X
You need to put the command after the "-X". So, there is a command--quit--after the first, but none after the second.

You're probably not doing anything too fast, since screen (I would guess) doesn't exit until it has delivered its command. You can insert a five second delay (insert a line saying "sleep 5"), but I don't think you need to.

Secondly, there's a convention of calling perl scripts (the one beginning with #!/usr/bin/perl) name.pl, not name.sh. Just a nitpicking, really.

For the apache error, please post the output of
Code:
$ ls -l /srv/www/htdocs/restart.php /srv/www/htdocs/restart.sh /home/mrgraper/restart.sh
What is your apache DocumentRoot (grep -r DocumentRoot /etc/apache*)? /srv/www/htdocs?
 
Old 09-14-2006, 08:11 AM   #20
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Original Poster
Rep: Reputation: 15
mrgreaper@linux:~> ls -l /srv/www/htdocs/restart.php /srv/www/htdocs/restart.sh /home/mrgreaper/restart.sh
-rwxr-xr-x 1 mrgreaper users 178 2006-09-14 14:13 /home/mrgreaper/restart.sh
-rwx------ 1 mrgreaper users 98 2006-09-12 11:46 /srv/www/htdocs/restart.php
-rwxr-xr-x 1 mrgreaper users 76 2006-09-11 17:28 /srv/www/htdocs/restart.sh


and yes that is the root folder of apache /srv/www/htdoc once its working the restart php page will be made more secure just want to get it working at mo


the lack of the quit command was indeed where i had gone wrong ... i di then have an error where it wasn`t loading the css-server screen when it ran the ./abc.sh i inserted 5 second pause between each command (not the echo command though) and it works wonderful now

the php is
the last remaining problemany ideas

and doc nice thank you for your help
and of course jonaskoelker
 
Old 09-14-2006, 02:17 PM   #21
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
Unless apache runs as mrgreaper (in which case why do you need to suid or sudo?), you need to chmod og+rx restart.php.
 
Old 09-15-2006, 12:20 PM   #22
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Original Poster
Rep: Reputation: 15
ok we apear to be getting closer
i did exactly as stated (while logged in as mrgreaper)

now instead of bing an error page the page very quickly displays all the echo commands from my scripts but doesnt do the commands (and that includes the sleep commands)

and all the echos are in one long line
IE
css off stats off folder change now running server scanning for new maps done starting stat server up stats up and running starting cstrike server all loaded you should see two screens with there ids You have now restarted the server.

at least we know its loading all the scripts and going through it but i don`t understand why its not running the commands? could it be trying to run them on the pc the webpage is displayed on rather then the local pc?

edit vnc`ed into the server pc loaded the page on its web browser same thing happened so now i really have no clue!?

Last edited by mrgreaper; 09-15-2006 at 12:22 PM.
 
Old 09-17-2006, 01:35 PM   #23
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
try:
Code:
<html>
<body>
<pre>
<? system "the restart comamnd" ?>
</pre>
</body>
</html>
where you replace the "the restart command" with the appropriate string.

Also, try prepending "#!/bin/bash -x" to the shell script.

There's a really long line in one of the code parts. Please wrap it around--it causes the page to become really huge and bulky, and cause horizontal scrolling.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
new challenge thebiggiantmouse Linux - Newbie 16 07-24-2006 10:03 AM
Want a challenge? TruckStuff Linux - Security 2 05-13-2005 02:39 AM
One of my biggest challenge! gcclinux JDS 1 10-23-2004 11:15 AM
The Penguin Challenge shane25119 General 8 04-15-2004 03:27 PM
a challenge for you derfaust Programming 3 03-12-2004 01:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:16 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration