• 写过的一些shell脚本总结


    每天晚上自动检查更新

    #!/bin/sh
    #auto gamedown2 version
    DATE=`/bin/date +%m%d`
    COUNT=`curl 'http://11.1.1.1/index.php?m=version&c=auto&a=zheng_count'`
    var=`expr $COUNT / 10` 
    for((i=1;i<$var;i++))
    do
    	#sleep 5s
    	curl 'http://1.1.1.1/index.php?m=version&c=auto&a=version_now&page='$i
    	echo $i --- `/bin/date +%k:%M:%S` >> /root/shell/auto/logs/$DATE.log
    done
    

     每天零点 1 分执行

    1 0 * * * /root/shell/auto/suto.sh

    键盘输入范围生成plist文件

    #!/bin/sh
    #create plist
    echo -n "Enter the number of updates required"  
    read COUNT                  
    YEAR=`/bin/date +%Y`
    DATE=`/bin/date +%m%d`
    mkdir -p /www/inst_fengzigame/plist/$YEAR/$DATE/
    chgrp www /www/inst_fengzigame/plist/$YEAR/$DATE
    
    for((i=1;i<$COUNT;i++))
    do
    	tagid=`curl 'http://1.1.1.1/index.php?m=version&c=plist&a=get_tagid&page='$i`
    	content=`curl 'http://1.1.1.1/index.php?m=version&c=plist&a=create_plist&tagid='$tagid`
    	echo $content > /www/inst_fengzigame/plist/$YEAR/$DATE/$tagid.plist
    done
    
  • 相关阅读:
    PAT 1017 Queueing at Bank
    一句有意思的代码
    PAT 1031 Hello World for U
    PAT 1024 Palindromic Number
    PAT 1032 Sharing
    各显神通
    ZJU PAT 1023
    静夜,乱思
    PAT 1024 Palindromic Number
    虚函数表
  • 原文地址:https://www.cnblogs.com/mr-amazing/p/4689839.html
Copyright © 2020-2023  润新知