Re: running php script from cron with permissions
| From: | Hamlet | Date: | Sun, 21 Jul 2002 21:11:24 +0000 |
| Subject: | Re: running php script from cron with permissions | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-86055@lists.php.net to get a copy of this message | ||
True. Somehow slipped my mind, now it works perfectly. PHP is awesome for
system scripting.
"David Eriksson" <david@2good.nu> wrote in message
news:Pine.LNX.4.21.0207212236430.24695-100000@natty.rsn.bth.se...
> On Sun, 21 Jul 2002, Hamlet wrote:
>
> > Hi there,
> >
> > I've got a problem that's just a tidbit annoying. I've got a neat little
php
> > script to keep my home network running. At one point in this script it's
> > required to reboot the machine the script is running on, and this I'm
trying
> > to do with exec("reboot").
> >
> > Now, I run the cron job as root, and if I try "php <? exec("reboot");
> > ?>
> > from console it works fine. But not when cron tries to. I've got my
> > suspicions as to cron doing something kinky with the permissions, and
> > therefore permissions are not enought for php to execute the reboot
command.
> >
> > I've been at this all day, suggestions are more than welcome.
>
> It's not certain that the "reboot" command is in your PATH environment
> variable when cron is running. Try adding a line similar to the one below
> in the beginning of your cron script, or specify the full path when you
> use exec() in PHP.
>
> PATH="/bin:/usr/bin:/usr/sbin"
>
> Regards,
>
> -\- David Eriksson -/-
>
> "I personally refuse to use inferior tools because of ideology."
> - Linus Torvalds
>