Re: Executing shell commands

From: Date: Sun, 09 Nov 2003 08:46:58 +0000
Subject: Re: Executing shell commands
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-168986@lists.php.net to get a copy of this message
On Sun, 2003-11-09 at 03:41, Teren wrote: > > Hi, I'm trying to write a front end for something and I want to be able > to execute shell commands. I tried all of the pre-written functions > and non of them would work. I setup a user that can sudo and then i > set apache to run as that user. So, what I tried to do is > shell_exec("sudo -s; reboot;"); but that didn't work, I also tried > other numerous variations all of which didn't work (also using exec(), > system(), passthru() ). If any one has any ideas how i can do this, > please let me know. Thanks I believe this has been answered quite recently and the large consensus was to have a daemon (cron or otherwise) check for some status file or database entry, which when set it would perform the required function. So for instance to reboot the machine, perhaps a cron job would check for the existence of /tmp/myFrontEnd/reboot and if found reboot the machine. Thus the front end would only need to create the file. HTH, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#168986) next »