Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 07:55

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Frage zu shell_exec

Discussion on Frage zu shell_exec within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
.Shalom's Avatar
 
elite*gold: 20
Join Date: Jul 2013
Posts: 304
Received Thanks: 49
Frage zu shell_exec

Hey,

Ich hab da mal eine Frage, wie realisiere ich, dass ich mit shell_exec einen Befehl ausführe, aber diesen dann nach nach einer variabelen Zeit wieder "kill".

Es sieht bisher so aus:

$time = time() + $_GET['time'];
while(1){
$pid = shell_exec('sudo /usr/bin/perl script.pl');
if(time() > $time){
shell_exec('kill '.$pid);
}
}

Es funktioniert aber nicht so wie ich will mit dem "killen".

Helft mir :P
.Shalom is offline  
Old 01/21/2014, 16:09   #2
 
mhaendler's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 1,826
Received Thanks: 226
Versuch mal folgendes:
Code:
exec("kill -KILL $PID");
Ansonsten hat hier einer eine Klasse "exec" geschrieben, welche meiner Meinung nach sehr interessant aussieht



Hoffe des klappt so
mhaendler is offline  
Old 01/21/2014, 18:46   #3
 
.Shalom's Avatar
 
elite*gold: 20
Join Date: Jul 2013
Posts: 304
Received Thanks: 49
Quote:
Originally Posted by dealaking View Post
Versuch mal folgendes:
Code:
exec("kill -KILL $PID");
Ansonsten hat hier einer eine Klasse "exec" geschrieben, welche meiner Meinung nach sehr interessant aussieht



Hoffe des klappt so
Hey,

danke für deine Antwort

Habs jetzt mit dem Link versucht, so funktioniert es aber auch nicht. Es startet nur den Prozess, aber beendet ihn nicht. Ich verzweifel langsam.. Hast Du vielleicht noch eine Idee?
.Shalom is offline  
Old 01/22/2014, 08:36   #4
 
mhaendler's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 1,826
Received Thanks: 226
Quote:
Originally Posted by .Shalom View Post
Hey,

danke für deine Antwort

Habs jetzt mit dem Link versucht, so funktioniert es aber auch nicht. Es startet nur den Prozess, aber beendet ihn nicht. Ich verzweifel langsam.. Hast Du vielleicht noch eine Idee?
Ich hab gerade das hier in einem anderen Forum gefunden,
Quote:
... you won't be able to kill a process from PHP unless it's running as the user that the web server runs as - nobody by default.
ich muss persönlich sagen ich hab es noch nicht probiert also ein shell script via php zu "töten" allerdings scheint es mir nach einer "Rechte" Ursache.

Stehen in deinem error.log Fehlermeldungen?
mhaendler is offline  
Old 01/22/2014, 09:38   #5
 
.Shalom's Avatar
 
elite*gold: 20
Join Date: Jul 2013
Posts: 304
Received Thanks: 49
Quote:
Originally Posted by dealaking View Post
Ich hab gerade das hier in einem anderen Forum gefunden,

ich muss persönlich sagen ich hab es noch nicht probiert also ein shell script via php zu "töten" allerdings scheint es mir nach einer "Rechte" Ursache.

Stehen in deinem error.log Fehlermeldungen?

Hey,

Erstmal danke für deine Hilfe, aber ich hab es jetzt mit ssh2 gelöst.
.Shalom is offline  
Reply


Similar Threads Similar Threads
[PHP] shell_exec: sudo: no tty present and no askpass program specified
10/19/2013 - Web Development - 3 Replies
Hey @ all, ich komm gleich mal zur Sache 1. ich möchte, dass mein Script eine shell/batch File executed 2. ich benutze: Linux Debian 6 | Apache2.4 | PHP 5.4.17 3. mein Command $execute_shell=shell_exec('sudo sh /home/usr/scripts/apache.sh 2>&1'); echo $execute_shell; 4. Fehlercode: no tty present and no askpass program specified 5. sudoers: Defaults !requiretty



All times are GMT +1. The time now is 07:55.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.