Hi Aparajita, This is similar to what I came up with this afternoon. The key part, as you note, is to have PHP write the file to a directory where it has write privileges. And yes I did have to chmod the directory within PHP's web root to allow this.
Earlier today I tried to use shell_exec(touch ...) to write the file but for some reason it failed. The php command fopen($pathtokillfile, 'x') works though. I've got a secure page that on successful authentication writes that file if it doesn't exist or notifies the user that a reboot has already been be scheduled. I'll work on the actual reboot code in the morning, but thanks for that script. I'll want to modify that to send mail notifying us that 4D was intentionally quit. Thanks, Brad Perkins ________________________________________ From: [email protected] [[email protected]] on behalf of Aparajita Fishman [[email protected]] Sent: Sunday, December 11, 2011 1:12 PM To: Active4D Developer Discussion List Subject: Re: [Active4d-dev] [OFF] Restarting 4D/Active4D from PHP It's very simple. Create the shell script kill4d.sh: #!/bin/bash KILLSIGNAL=/path/to/writeable/directory/killsignal while true do if [[ -f "$KILLSIGNAL" ]]; then rm -f "$KILLSIGNAL" killall 4D fi sleep 1 done Change KILLSIGNAL to point to a path within a directory that is writeable by PHP. You may have to chmod a directory within PHP's web root to allow this. Then do: chmod +x kill4d.sh The run it as whatever user launches 4D. All your PHP script has to do is: shell_exec('touch /path/to/writeable/directory/killsignal'); That should do it. > I'll look into that. Our launchd process that keeps 4D alive uses a shell > script that wraps an applescript. PHP could call > > shell_exec('osascript tryToKill4d.scpt'') > > but I again my run into the problem where _www (the apache/php user) can't > run the script due to permissions. Regards, Aparajita _______________________________________________ Active4D-dev mailing list [email protected] http://list.aparajitaworld.com/listinfo/active4d-dev Archives: http://vasudev.aparajitaworld.com/archive/active4d-dev/ _______________________________________________ Active4D-dev mailing list [email protected] http://list.aparajitaworld.com/listinfo/active4d-dev Archives: http://vasudev.aparajitaworld.com/archive/active4d-dev/
