zoukankan      html  css  js  c++  java
  • 给大家分享一个备份七牛云视频到本地磁盘的shell脚本

     1 #!/bin/bash
     2 
     3 ##################################################
     4 #     qiniu video download script                #
     5 ##################################################
     6 
     7 # 下载qshell
     8 
     9 cd /usr/local/src/
    10 
    11 wget "https://dn-devtools.qbox.me/2.1.5/qshell-linux-x64"
    12 
    13 # 创建qshell目录,添加配置文件目录
    14 
    15 mkdir -p /usr/local/src/qshell
    16 
    17 cd qshell && mv /usr/local/src/qshell-linux-x64 qshell
    18 
    19 #写入目录
    20 
    21 destdir="/data/qiniu_backup/"
    22 
    23 read -p "Please use the absolute path to enter the directory name:" destdir
    24 
    25 if [ -n "$destdir" ]; then
    26     mkdir -p $destdir
    27 fi
    28 #添加执行权限
    29 
    30 chmod +x qshell
    31 
    32 # 配置文件
    33 
    34 touch download.conf
    35 
    36 cat > /usr/local/src/qshell/download.conf << EOT
    37 {
    38    "dest_dir":"$destdir",
    39    "bucket":"你的bucket",
    40    "referer":"无防盗链可留空",
    41    "prefix":"",
    42    "suffixes":""43 }
    44 EOT
    45 
    46 #当前用户
    47 
    48 ./qshell account  access_key secret_key
    49 
    50 # 生成计划任务,每天凌晨一点执行一次  导出七牛空间视频到指定文件夹 
    51 # 下载的并发协程数量为 10    
    52 
    53 echo "0 1 * * * root cd /usr/local/src/qshell/ && ./qshell qdownload 10 download.conf&" >> /etc/crontab
    54 
    55 #重启计划任务
    56 
    57 /bin/systemctl restart crond.service
    58 #如果做成了服务则如下重启
    59 service crond restart
    60   

    如果你有任何疑问,可在下方留言。欢迎讨论。

  • 相关阅读:
    JavaScript字符串转换为变量名
    python对象反射和函数反射
    android studio 更新Gradle版本方法
    【Node.js】'readline' 逐行读取、写入文件内容
    nodejs 设计模式
    MongoError: server instance in invalid state undefined 解决办法
    nodejs对mongodb数据库的增删改查操作(转载)
    JSON详解
    mac 安装python3
    Oracle_安装说明
  • 原文地址:https://www.cnblogs.com/black-humor/p/8650178.html
Copyright © 2011-2022 走看看