Data Flow Completion Script

Source: Internet
Author: User

The online cache stream often causes data synchronization to be incomplete due to network problems, requires manual download, and is now scripted to complete the download, but requires passing in three parameters: Channel name, start time, end time.

#!/bin/bash# incoming parameter read -p  "Please input english channel name:"  channelread  -p  "Please input starttime: ' 1970-01-01 00:00:00 '  "   starttimeread  -p  "Please input endtime: ' 1970-01-01 00:00:00 '  "  endtime# Convert time Variables starttime= ' date --date= ' $Starttime '  +%s ' endtime= ' date --date= ' $Endtime '  +%s ' echo   $channel, $starttime, $endtimeYear = ' date --date= ' $Starttime " +%y ' month= ' date --date=" $ Starttime " +%m ' date= ' date --date=" $Starttime " +%d ' basicdir=/opt/online01/streamcodetype= 2500000links -dump   "Http://xxxx.live.tvmining.com/approve/vod?type=ipsd&channel= $channel &starttime= $starttime &endtime= $endtime " | grep http > stream.m3u8for  file in  ' cat stream.m3u8 '         do                 localfile= $basicDir/' echo  $file  | awk -F stream/  ' { print $2} '                  if [ -e  $localfile  ];then                         echo  $localfile  already exists                 else                         if [ -e  $basicDir/$codetype/$channel/$ year/$Month/$Date  ];then                                  wget  $file    -p  $basicDir/$codetype/$channel/$Year/$Month/$Date  &> /dev/null &&  echo  "$file  down sucessfully"                          else                                  echo  $basicDir/$codetype/$channel/$Year /$Month/$Date  not exists && exit 12                         fi                 fi         done

Only as a self-learning parameter

This article from "Eagle" blog, declined reprint!

Data Flow Completion Script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.