LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Using cron/crontab (https://www.linuxquestions.org/questions/linux-newbie-8/using-cron-crontab-4175616178/)

Oblivionsmist 10-22-2017 09:06 PM

Using cron/crontab
 
I need to write a script to download the contents of a website that the user enters every day at 3:00pm

I don't know how to use cron properly but this is what i have so far:

Code:

echo "enter a website"
read website
echo 0 3 * * * wget $website >> etc/crontab

Would this work?

frankbell 10-22-2017 09:20 PM

Likely not. I have three thoughts:

The first thing is, it's probably not a good idea to wget the files into the /etc/crontab directory, rather than to a subdirectory of ~/.

Second, I don't the output of the "read" command would appear in the user's terminal (I may be wrong on this), so you wouldn't be able to enter the website name; cron jobs work behind the scenes and are not really designed to be interactive. Even if the output of read does appear in the terminal, will someone be there at 3 a. m. to see the query?

Here's a good tutorial: https://www.howtogeek.com/101288/how...crontab-files/

Afterthought:

I just learned the "read" command myself. I congratulate you for learning it,


All times are GMT -5. The time now is 08:49 AM.