[BlueOnyx:11523] Re: Need CGI script to execute command as root

DD bqlist at distortal.com
Fri Oct 12 08:56:51 -05 2012


>> FWIW... How about a cronjob run as root?
>If I cannot get this figured out then I will definitely pursue your
suggestion, thank you!

Not sure if this helps, but I have several PHP jobs running under cron as
follows:

In /etc/crontab:
* * * * * root /home/sites/www.yourdomain.tld/cron/yourcron.cron

Then yourcron.cron (owned by root) is:

#!/bin/bash
cd /home/.sites/XXX/siteX/cron/
php >/dev/null -d
open_basedir=/tmp/:/var/lib/php/session/:/usr/sausalito/configs/php/:/home/.
sites/XXX/siteX/ -d allow_url_fopen=1 ./myscript.php


You'll probably need -d open_basedir, but allow_url_fopen is only required
for scripts that need to access the internet.

Regards,



DD





More information about the Blueonyx mailing list