[Cialug] Cron PHP job

dave at usalug.org dave at usalug.org
Thu Sep 28 15:51:49 CDT 2006


I thought to use php and cron you needed to use wget/curl/apache .....

something like

0 4 * * 1,2,3,4,5 wget http://www.myurl.com/nightlybackup.php


......... on a side note...... I have a shell script that I use every
night on my servers that doesn't require that at all......

for i in `mysql -B -e "show databases" | tail +2`; do
mysqldump --opt $i | gzip -9 > /var/backups/mysql/$i.`date --iso-8601`.gz
ls -t /var/backups/mysql/$i.* | tail +7 | xargs rm -f
done

Don't know if that helps or hinders..... best of luck.


Dave Crouse
USA Linux Users Group
---------------------
My Public Key is available here:
http://usalug.org/phpBB2/viewtopic.php?p=9366#9366


On Thu, September 28, 2006 3:08 pm, Dave J. Hala Jr. wrote:
> Is there a mysql user for the user that cron is running the job as?
>
>
>
>
> On Thu, 2006-09-28 at 14:31, Tony Bibbs wrote:
>
>> ...and ensure the user the cron is run as has access to everything it
>> needs.  I'm guess you've done that already, though.
>>
>> David Champion wrote:
>>
>>> Chris Van Cleve wrote:
>>>
>>>> I have a cron job set to run every night at 12:05 AM. It's executes
>>>> a PHP script that backs up a MySQL database server, pipes the output
>>>> through gzip, then removes any backups older than 7 days.
>>>>
>>>> When run from the command line, it runs perfectly fine. When run
>>>> through cron, I get an 8KB gzip file rather than a 20MB gzip file.
>>>> Any ideas why
>>>> the script runs successfully, but doesn't actually dump the
>>>> databases when executed via cron?
>>>>
>>>> I'm stumped.
>>>>
>>>>
>>>
>>> Check to see if everything in the script is using absolute paths -
>>> cron jobs are really picky about that.
>>>
>>> -dc
>>>
>>>
>>>
>>> _______________________________________________
>>> Cialug mailing list
>>> Cialug at cialug.org
>>> http://cialug.org/mailman/listinfo/cialug
>>>
>> _______________________________________________
>> Cialug mailing list
>> Cialug at cialug.org
>> http://cialug.org/mailman/listinfo/cialug
>>
> --
>
>
> Open Source Information Systems, Inc. (OSIS)
> Dave J. Hala Jr., President <dave at osis.us>
> 641.485.1606
>
>
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>
>






More information about the Cialug mailing list