[ubuntu-za] crontab

David Rubin davidrub at gmail.com
Sun Feb 8 17:11:18 GMT 2009


Hi

Scharnick, Walter wrote:
> I don't specify a user. I quess when I do crontab -e that it will run as
> myself. See below...
> Walter at uu~/runfive$ crontab -l
> 0,5,10,15,20,25,30,35,40,45,50,55 * * * 1,2,3,4,5,6,7 cd / &&
> /var/www/mrtg/runfive/hawk.php
>
>   
First thing I noticed if you changed directory to /  ie the top level
directory. Then you run a script from an absolute path ie 
/var/www/mrtg/runfive/hawk.php in php the files path goes by your pwd ie
current working directory. so doing fopen(../n_tunnel_UpDownStates.dat):
would try and go up a dirrectory from the root not valid file.

try this 
0,5,10,15,20,25,30,35,40,45,50,55 * * * 1,2,3,4,5,6,7 cd /var/www/mrtg/runfive/ && ./hawk.php

also it seems you need this cron job to run every 5 mins you could replace that with 
 */5 * * * 1,2,3,4,5,6,7 cd /var/www/mrtg/runfive/ && ./hawk.php

This might explain it better then I could.
https://help.ubuntu.com/community/CronHowto 


-- 
David Rubin
Email 	: davidrub [at] gmail [dot] com
Cell  	: +27(0)720405455  

>
> -----Original Message-----
> From: ubuntu-za-bounces at lists.ubuntu.com
> [mailto:ubuntu-za-bounces at lists.ubuntu.com] On Behalf Of Stefan Lesicnik
> Sent: Sunday, February 08, 2009 6:51 PM
> To: Ubuntu South African Local Community
> Subject: Re: [ubuntu-za] crontab
>
> Heys,
>
> Permission problem. Not with your script, but rather with the file
> trying to open or write to - n_tunnel_UpDownStates.dat
>
> Who is the script running as? Does that user have access to write to
> that file?
>
> Stefan Lesicnik
>
> Linux System Dynamics
>
> mail: stefan at lsd.co.za
> tel : +27 (0)86 111 6094
> cell: +27 (0)84 951 9321
> gpg : http://www.lsd.co.za/files/keys/stefan.gpg.pub
>
>
>
>
> On Sun, Feb 8, 2009 at 6:29 PM, Scharnick, Walter <WScharnick at fnb.co.za>
> wrote:
>   
>> Hi Everyone, I have a php-cli script that does snmp queries and writes
>>     
>
>   
>> to a file. The script runs fine when I run it from the command line, 
>> but there is a problem when I give the job over to cron. I have tried 
>> playing around the the file permission and ever set it to 777, but
>>     
> still no luck.
>   
>> The error: Warning: fopen(../n_tunnel_UpDownStates.dat): failed to 
>> open
>> stream: Permission denied in /var/www/mrtg/runfive/hawk.php on line 89
>>
>>
>> Any ideas????
>>
>> To read FirstRand Bank's Disclaimer for this email click on the 
>> following address or copy into your Internet browser:
>> https://www.fnb.co.za/disclaimer.html
>>
>> If you are unable to access the Disclaimer, send a blank e-mail to 
>> firstrandbankdisclaimer at fnb.co.za and we will send you a copy of the 
>> Disclaimer.
>>
>> --
>> ubuntu-za mailing list
>> ubuntu-za at lists.ubuntu.com
>> https://lists.ubuntu.com/mailman/listinfo/ubuntu-za
>>
>>
>>     
>
> --
> ubuntu-za mailing list
> ubuntu-za at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-za
> To read FirstRand Bank's Disclaimer for this email click on the following address or copy into your Internet browser: 
> https://www.fnb.co.za/disclaimer.html 
>
> If you are unable to access the Disclaimer, send a blank e-mail to
> firstrandbankdisclaimer at fnb.co.za and we will send you a copy of the Disclaimer.
>
>   




More information about the ubuntu-za mailing list