Php – crontab – how to create in Terminal

cronmac-osxPHPterminal

I'm trying to run a scheduled task on my shared Linux server using the crontab via Terminal on my Mac.

I can login to my ssh OK, and can view directories etc with ease.

I try and create/edit my crontab by using…

crontab -e

But i get the response

no crontab for [username] – using an empty one

So trying to then add my line to set my schedule up, and Terminal just doesn't seem to respond.

10 * * * * /home/username/www/myphpfile.php

Any clues what on earth I'm doing wrong? Or a link to a clear step-by-step tutorial?

I have checked with the webhost that this is supported, it's just undocumented!

All I want to do is run a php script every so often through the day (to check for updates to an XML file).

Best Answer

I'm betting the $EDITOR variable is set to vi(m).

If you press i to go to interactive mode are you then able to enter your crontab?

If so after you are done entering your cron entry, press escape then type :wq<enter> to save your changes.

Also, learning vi(m) is a good thing check out: http://acs.ucsd.edu/info/vi_tutorial.shtml for a beginner's tutorial.