Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I wanted to know how to automatically visit a website in the background when Ubuntu loads. As far as I know w3m is for visiting web site from the console. That is why I am writing following command in the crontab -e.

@reboot w3m http://example.com/ > test_file

The reason for writing content of the web site into a test_file is just to know whether this command has been executed or no. Unfortunately it is not executing every time Ubuntu loads. But next command which comes after it and looks like this: @reboot date >> reboot_file is being executed every time.

What is wrong with my command? When I execute it in the console it outputs the content of the example.com into test_file.

Is there any other options to do that?

share|improve this question
    
Just a long shot, but does test_file exist already? What are the permissions on it if it does? –  Nathan Osman Feb 28 '11 at 1:51
    
Where are you checking for test_file? It might help to use a full path such as /home/user/test_file. –  ændrük Feb 28 '11 at 5:29
add comment

2 Answers 2

up vote 2 down vote accepted

Use absolute paths where possible. It's possible that PATH=/bin, which works for date (=> /bin/date), but not for w3m (which is located at /usr/bin/w3m).

@reboot /usr/bin/w3m http://example.com/ > test_file

For further troubleshooting, look at /var/log/syslog; cron writes all executed commands to there.

Example of failed command:

Feb 28 13:27:01 ubuntu CRON[23705]: (username) CMD (/failing/command)
Feb 28 13:27:01 ubuntu CRON[23704]: (CRON) error (grandchild #23705 failed with exit status 127)
Feb 28 13:27:01 ubuntu CRON[23704]: (CRON) info (No MTA installed, discarding output)
share|improve this answer
add comment

How about catching the error messages in that file too:

@reboot w3m http://example.com/ > test_file 2>&1
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.