LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-22-2017, 09:06 PM   #1
Oblivionsmist
LQ Newbie
 
Registered: Oct 2017
Posts: 6

Rep: Reputation: Disabled
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?
 
Old 10-22-2017, 09:20 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 17,395
Blog Entries: 27

Rep: Reputation: 5405Reputation: 5405Reputation: 5405Reputation: 5405Reputation: 5405Reputation: 5405Reputation: 5405Reputation: 5405Reputation: 5405Reputation: 5405Reputation: 5405
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,

Last edited by frankbell; 10-22-2017 at 09:53 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/etc/crontab vs /etc/cron.d vs /var/spool/cron/crontabs/ drManhattan Linux - Newbie 9 01-04-2011 01:12 AM
[SOLVED] cron and crontab help banditman Slackware 10 05-31-2010 05:52 PM
crontab -e vs /etc/cron.* rosv Debian 1 09-16-2008 07:39 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 01:57 AM
Cron/Crontab loocw Linux - General 2 03-08-2001 02:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration