Last active
April 1, 2018 03:21
-
-
Save wangxu0/01f18c1c1d4a288cd12f52193927e185 to your computer and use it in GitHub Desktop.
greening.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd ${your project home} | |
start="2017-07-23" | |
period=30;#days | |
random_hour=("20" "21" "22" "23" "00" "01" "02" "03") | |
#random number in [left,right) | |
function rand(){ | |
left=${1} | |
right=${2} | |
lr=$[$right-$left] | |
random_lr=$[$RANDOM%$lr] | |
ret=$[$random_lr+$left] | |
echo $ret | |
} | |
date -s ${start} >/dev/null 2>&1 | |
date -s "20:36:58" >/dev/null 2>&1 | |
days=1 | |
while [ ${days} -le ${period} ]; do | |
#TODO git commit | |
echo $(date +"%Y-%m-%d %H:%M:%S") >> commmit.log | |
git add . | |
git commit -m 'logging commit info' | |
date_str=$(date -d "-5 day ago" +%Y-%m-%d) | |
hour=${random_hour[$(rand 0 ${#random_hour[@]})]} | |
min=$(rand 10 60) | |
sec=$(rand 10 60) | |
time_str=${hour}":"${min}":"${sec} | |
#echo ${date_str} | |
date -s ${date_str} >/dev/null 2>&1 | |
date -s ${time_str} >/dev/null 2>&1 | |
#echo $(date +"%Y-%m-%d %H:%M:%S") | |
days=$((days+1)) | |
done | |
#Correction time | |
ntpdate time.pool.aliyun.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment