0

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.

5
  • 2
    How often do you want the cron job to execute?
    – Paul Tomblin
    Commented Dec 31, 2010 at 16:21
  • then do not use it ... en.wikipedia.org/wiki/Cron
    – ajreal
    Commented Dec 31, 2010 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
    Commented Dec 31, 2010 at 16:26
  • Which host are you using?
    – dmah
    Commented Dec 31, 2010 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
    Commented Oct 19, 2012 at 14:25

2 Answers 2

1

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.

1

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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