Damn ISM internet !
We don’t have internet connection till it is 6’O clock evening, and they kill it at 2:30 AM. It’s 4:30 PM and i am waking up from my bed thinking that “What is the time? I have to start the downloading the Youtube java tutorial playlist, still there are 6 videos to download”.
Then it struck to me that “How about writing a bash script to check the internet connection(not LAN connectivity) and start download if it is true”. A wget command, if else condition on wget return and some sleep to the program, BINGO i got the script in my mind within a couple of minutes.
#/bin/bash while true do wget -q --tries=10 --timeout=20 http://google.com if [[ $? -eq 0 ]]; then echo "hey dont forget to press CTRL-C when all the downloads are completed, as i am not programmed to do that" echo "any way my developer is still trying to improve this issue" youtube-dl --playlist-start=11 "https://www.youtube.com/playlist?list=PL07BAEC9E3E9E49F3" else echo "there is no internet connection ! so i am starting the download" echo "---------------------------------------------------------------" fi sleep 2 done
Advertisements