0

I've never written a cron job cmd before in my life, and I want to make sure its right before I run it on my site so nothing messes up.

There is a json feed that my script autopost.php grabs and adds to my database. Usually I just point my browser to the file so it runs and updates the database but I hear cronjobs can do that automatically for me. Would this be correct?

wget -O http://www.domain.com/autopost.php 

EDIT:

Okay with your help I got it working. However it only work when I added /dev/null after wget -O Why is that?

Eric Smith
  • 1,336
  • 4
  • 17
  • 32
  • Your line lacks at least the timing parameters. How is cron supposed to know when it should execute it ? Read this : http://en.wikipedia.org/wiki/Crontab – Denys Séguret Jul 18 '12 at 20:00

2 Answers2

1

-sure it can !!

follow this link and you will be able to program you job every time you want : www.aodba.com

Up_One
  • 5,213
  • 3
  • 33
  • 65
1

You're missing the run schedule part of the cron command. you need something like this:

* * * * * wget -O http://www.domain.com/autopost.php 

That says "do a wget every minute. For the syntax, see: http://www.adminschoice.com/crontab-quick-reference

dkniffin
  • 1,295
  • 16
  • 25
  • I got it working! However it only works when I added /dev/null after wget-O ... Im glad it works but can you explain what /dev/null does? – Eric Smith Jul 18 '12 at 20:23
  • I tend to think of /dev/null as a "black hole". It's basically like sending stuff to the garbage. Any output from when the command gets run gets ignored. I'm assuming your command now looks like this?: `* * * * * wget -O http://www.domain.com/autopost.php > /dev/null` – dkniffin Jul 18 '12 at 21:36