I was able to run the following command in putty successfully.
/usr/bin/wget -q -O /dev/null http://myhomepage.com/cron.php

However, when I add schedule information in front of the command, I get "bash: [some number]: command not found" message.
30 * * * * /usr/bin/wget -q -O /dev/null http://example.com/cron.php
The command above gives me "bash: 30: command not found" message.

Is there something I am doing wrong here?

Comments

johnhanley’s picture

It appears to be misinterpreting the beginning '30' as a command.

You might try (re)reading the Configuring cron jobs documentation for clues.

FWIW, I've always had success using lynx.

cog.rusty’s picture

The scheduling information are not supposed to run with a shell command. You use the 'crontab' command to insert that line in a file, the "cron table".

Then the 'cron' daemon executes the command at the specified times.

See http://www.ss64.com/bash/crontab.html for the correct syntax.

leed’s picture

Now I am having trouble saving crontab after editing the file.
I tried Ctrl + x s but all I get is ^X mode (^E/^Y/^L/^]/^F/^I/^K/^D/^V/^N/^P) at the bottom of putty window.
How can I save the crontab file and get out of it?

cog.rusty’s picture

Not sure. Depends on the editor the system is using.
Try "ctrl-k x".
Or "esc : w q"
Or, if you can see the editor's name somewhere, google for the editor's name and linux editor "save and exit"
Or use the syntax which imports from a file.

davidcv’s picture

Here's how to save cron:

If you didn't have any cronjobs set up, when you do

> crontab -l nothing should show up, just a message like "no crontab files for user" or something.

> crontab -e (to edit the file, says something like editing empty file)

Type "o" to start inserting lines of text for the cronjob (if you just start typing, you will get that error message)

# 1st line of crontab comments (per phpadnews admin guide)
2nd line of crontab instructions

Now: to save and exit, you need to change modes, so type "esc" and then ":" and that should bring up a cursor at the very bottom of your screen with the ":"

To write the file, type "x" and hit "enter". The job should save. To test this, at the ">" prompt, type crontab -l and you should see your command.