LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-01-2019, 05:26 PM   #1
bajathomas
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Rep: Reputation: Disabled
how to start youtube-dl at a later time


Hello, Everybody, I am for six years now on Mint, and very happy with the change! As I live high up in the Sierra in BCS, I have a Hughes Sattelite System (archaic), which is very "bandwidth-restrictive", but allows five hours of "free" use from midnight on. I hate getting up at midnight just to press the ENTER key on youtube-dl -a..., but don't know how to solve this problem. As I am 74 and have bad sight, please forgive if a similar question has been overlooked by me and just give me the link.
I would be extremely grateful to you if you could help me out of this "Midnight-Dilemna" and let me sleep again without interruption :-)
Best regards and thanks to all the unknown helpers in the many question &answers sections I have read to great avail these years !!!
Cheers
Thomas
 
Old 05-01-2019, 05:29 PM   #2
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,953

Rep: Reputation: 270Reputation: 270Reputation: 270
Code:
at
or
Code:
crontab
 
Old 05-01-2019, 06:17 PM   #3
dan.mera
LQ Newbie
 
Registered: Feb 2009
Posts: 21

Rep: Reputation: 9
example

assumming you have - at - installed. otherwise you need to install it. (via yum, zypper,etc depends on your linux flavor)
you should do this:
echo "youtube-dl http://your link" |at -m 0:05

or if you have multiple ones write them in a file and add it to crontab. if you need help ask and i will give you an example

Last edited by dan.mera; 05-01-2019 at 06:41 PM.
 
1 members found this post helpful.
Old 05-01-2019, 10:35 PM   #4
bajathomas
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks, Random Troll, but that was very rudimentary and only really useful for "experts", of which I am none :-)

Dan.Mera - thank you so much - have made a trial ready for tonight with one youtube-video. Hope so much it will work !!!
Normally, I use youtubepdl like this:

youtube-dl -ci -f 18 -a z18 (z18 being a file collection)

Can I also use your example, modified like this:

echo "youtube-dl -ci -f 18 -a z18 |at -m 0:05

If YES, that would solve all my earthly problems (almost) :-)

If not, please be so kind and send me the crontab "version"

I am using MINT 19.1 on a Lenovo Laptop

Thank you for your kind attention.

Thomas
 
Old 05-02-2019, 05:31 AM   #5
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,953

Rep: Reputation: 270Reputation: 270Reputation: 270
Quote:
Originally Posted by bajathomas View Post
Thanks, Random Troll, but that was very rudimentary and only really useful for "experts", of which I am none :-)
I wrote it to begin a conversation. Ideally you would have run the man pages for both then, if you couldn't figure it out, ask again.


Quote:
Originally Posted by bajathomas View Post
please be so kind and send me the crontab "version"
Run
Code:
 crontab -e
Enter
Quote:
1 0 * * * youtube-dl -ci -f 18 -a z18
save (crontab -e will have started an editor) then quit. At 1 minute past midnight every day youtube-dl -ci -f 18 -a z18 will run. Every line in a crontab file has 6 arguments: minute, hour, day, month, day-of-week, file-to-run. If you want to run it only some days or months you can change the *s to specify by name or number days or months. Prepending a # will turn a line into a comment, if you want the line to not-run but don't want to remove if from your crontab file.
 
1 members found this post helpful.
Old 05-02-2019, 10:36 AM   #6
bajathomas
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thank you very much, Random Troll, now that did help -
will use your cron-"formula" tonight and hope for the best.
By the way, I did check the man-pages after your first post, but what is missing in these pages, IMHO, are a few typicall examples at the end - that would clarify the often very dry and technical (not to say obscure) text - no doubt excellently done, but not for Newbies or old geezers like me who read the screen with strong lenses and a lupa !
Anyway, thanks and will report the moment it works or ask some more dumb questions.
Cheers Thomas
 
Old 05-02-2019, 10:55 AM   #7
dan.mera
LQ Newbie
 
Registered: Feb 2009
Posts: 21

Rep: Reputation: 9
typo in your command

a small typo in the command should be like this:
echo "youtube-dl -ci -f 18 -a z18" |at -m 0:05

this will need to be typed everytime after you updated your z18 file.
the cron will run daily so you will need to comment the line if you don't want to download something new like this:
crontab -e
and then insert a # before the 1 0 * * * youtube-dl -ci -f 18 -a z18
like this:
#1 0 * * * youtube-dl -ci -f 18 -a z18
until you have a new content in the z18 file and you want another download at midnight.

Last edited by dan.mera; 05-02-2019 at 11:00 AM. Reason: few more details
 
1 members found this post helpful.
Old 05-02-2019, 03:07 PM   #8
bajathomas
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thank you, Dan, I appreciate your help - I now have a fairly good idea how this works and should be able to get the contraption going tonight.
By the way, I guess I can just leave the cron-order "running" and just switch off the Lap when I go to bed, on those days where there is nothing to download ?! That should work, or don't you think?
Can one use two cron-jobs at the same time? Like:

1 0 * * * youtube-dl -ci -f 18 -a z18
and
1 0 * * * youtube-dl -ci -f 249 -a z249

That would make a more efficient downloading possible -
video- and audio-files at the same time. Just wonder :-)

Tghanks agfain to both Dan and Troll for your time and effort; now I'll try a hell of a lot to get it going :-)
 
Old 05-02-2019, 04:21 PM   #9
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,953

Rep: Reputation: 270Reputation: 270Reputation: 270
crontab jobs have a limited path. If youtube-dl isn't in the path it'll just report a not found error. To make sure I always supply a full path in crontab. For instance, youtube-dl is in /usr/local/bin on my system; /usr/local/bin isn't in the path crontab uses, so I'd write /usr/local/bin/youtube-dl
 
1 members found this post helpful.
Old 05-02-2019, 06:41 PM   #10
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
$ sleep X; youtube-dl ...

Where X is the number of seconds.

60 = 1 minute
360 = 1 hour

It requires some math, but bash does math on the CLI.

$ echo $(( $(( 60 * 60 )) * 5 )); # AKA 5 hours

Or forgo math and do multiple commands per hour.

$ echo 1; sleep 360; echo 2; sleep 360; echo 3; sleep 360; echo "go"; youtube-dl ...

For those of use too lazy (or paranoid) to use unknowns.
 
1 members found this post helpful.
Old 05-02-2019, 09:51 PM   #11
bajathomas
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
SHADOW 7, you nailed it !!!
Immediately got it going and working !!!
And I had started to download some articles and youtubevideos on cron to really "get it" and
be able to use it, but there are so many things
to learn like the path-"declarations" that Troll mentioned etc.pp. - for an old grand-grandfather a big deal.
I understand that "cron" and "at" are the tecnically
more "ambitious" and elegant solutions, but - hell,
this is a solution as simple as it is foolproof ! :-)
Thank you so much for your inspiration -you made my day!!!
How good one feels when a pressing problem is resolved!

My very best reagrds - also to Troll and Dan !
from Rancho Las Palmas en la Sierra de la Giganta, BCS
 
Old 05-03-2019, 09:20 AM   #12
dan.mera
LQ Newbie
 
Registered: Feb 2009
Posts: 21

Rep: Reputation: 9
Hi bajathomas, to answer your questions:
the crontab is not executed if the laptop is down.
you can 2 or more lines to use different files, but if they run in parallel then they will slow each other, imagine a pipe through which 2 flows are going at the same time and you want to fill 2 or more buckets at the same time, it will work but patience. this being at night should be fine, hopefully able to complete by 4AM(free time).
good luck!
seen some nice pictures from Rancho Las Palmas en la Sierra de la Giganta

Last edited by dan.mera; 05-03-2019 at 09:22 AM.
 
1 members found this post helpful.
Old 05-03-2019, 09:19 PM   #13
bajathomas
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thank you, Dan, although (with the sleep-method) I got lucky last night, and the littemath is no bother, I plan to "make myself more knowledegable" as far as LINUX commands are concerned, and especially cron and at.
So, your helpful hints will be well remembered soon...
In the meantime, I can sleep again quietly and that means a lot for me !
Yeah, this is a nice place, if you like the desert and "bare minimums", as I like to call it, but it has it charm and attraction - I love the quiet and peace, being far away from the madding crowd and having my own water and solar electricity plant, being at least a bit independent...
You probably saw the ad for the sale of the Rancho, eh??
For health reasons (my eyes are fading away = Macular deterioration, and arthritis and gout, nice combo!)
It;s tough, but has to be, I can't manage 150+ acres any more, and got to be nearer to town, Loreto or La Paz,on the outskirts, hopefully being able to find something at least a bit comparable in quiet and independence. Will see


Thanks again for your kind help and take good care of yourself and yours - thesde are trying times and there are dark clouds looming on the horizon...

Best
Thomas
 
  


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
LXer: youtube-dl – download Youtube videos from linux command Line LXer Syndicated Linux News 0 06-24-2014 12:11 PM
LXer: Youtube Downloader (youtube-dl) Helper Script LXer Syndicated Linux News 0 09-28-2013 01:50 PM
LXer: Search YouTube videos on Ubuntu with the YouTube Lens LXer Syndicated Linux News 0 12-30-2011 08:40 PM
LXer: Save a Web page for later with Read It Later extension LXer Syndicated Linux News 0 09-29-2008 11:50 AM
LXer: Youtube-dl - Download videos from Youtube in openSUSE LXer Syndicated Linux News 1 08-14-2008 08:10 AM

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

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

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