Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I need to setup a cronjob on my webhost.

The documentation for my webapp reads as follows:

you will need to create following cronjob: /public_html/cake/console/cake -app /public_html/app master

Also, I want any output written to a log file. My hosts documentation says this:

You can have cron send an email everytime it runs a command. If you do not want an email to be sent for an individual cron job you can redirect the command's output to /dev/null like this: mycommand >/dev/null 2>&1

I don't know the syntax to implement this from a cron job.

share|improve this question
2  
How often do you want the cron job to execute? –  Paul Tomblin Dec 31 '10 at 16:21
    
then do not use it ... en.wikipedia.org/wiki/Cron –  ajreal Dec 31 '10 at 16:21
    
every 6 hrs.... but my host has fields to setup the time, the hosting page looks like this:img574.imageshack.us/img574/9774/cron.jpg –  Randy Dec 31 '10 at 16:26
    
Which host are you using? –  dmah Dec 31 '10 at 22:27
    
What will stop people from executing your cron job if they know the direct URL to it? You should implement some basic authentication for it like a secret key that your application checks before executing the code. –  Anagio Oct 19 '12 at 14:25
add comment

migrated from stackoverflow.com Dec 31 '10 at 19:23

This question came from our site for professional and enthusiast programmers.

2 Answers

Based on the screenshot that you posted, you just need to know the correct path of the command that you are trying to run. It's possible that you just need to remove the leading '/' from your command and the path that you specify after -app. This assumes that your host sets up the cronjob to run as your user and that your public_html directory has its root in your home directory.

share|improve this answer
add comment

Check out this guide for Crontab Syntax and this tutorial to disable crontab mail (there are a couple of options in the tutorial to disable cron from emailing you the script output).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.