kusanagi
kusanagi

Reputation: 14614

how create cron command

how can i call some url like stackoverflow.com from cron without getting return data from page?

Upvotes: 1

Views: 6900

Answers (2)

dogbane
dogbane

Reputation: 274532

The format for cron is as follows:

# Minute   Hour   Day of Month       Month          Day of Week        Command    
# (0-59)  (0-23)     (1-31)    (1-12 or Jan-Dec)  (0-6 or Sun-Sat)                

For example, a cron to run at 9am every day and connect to a site would look like this:

0 9 * * * wget --spider http://www.stackoverflow.com > /dev/null 2>&1

Run crontab -e to edit the crontab, add this line to it and save.

Upvotes: 6

Numenor
Numenor

Reputation: 1706

use this:

wget --spider http://www.stackoverflow.com > /dev/null 2>&1

This command calls the url but doesnt download the output and redirect stderr and stdout to /dev/null

Upvotes: 2

Related Questions