1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| # /bin/bash
# Author: MetaNetworks
# Description: 截取截图并保存,
# $1 : http://url
if [[ ! -d ~/record ]]; then
mkdir ~/record
fi
cd ~/record
echo -e 'Cleaning 3 Days...\n'
find ~/record -type f -mtime +3 | xargs rm -rvf
n=1
while [[ true ]]; do
pic_name=$(date "+%Y-%m-%d-%H-%M-%S").jpg
echo 'Fetching:'$pic_name'\n'
#
echo "curl -u 1101:1101 $1/\?action\=snapshot\&n\=$pic_name\&n="$n" --output `pwd`/$pic_name"
curl -u 1101:1101 $1/\?action\=snapshot\&n\=$pic_name\&n=$n --output `pwd`/$pic_name
sleep 5
let n+=5
# 删除无
if [ $(($n%216000)) -eq 0 ]; then
echo -e 'Cleaning...\n'
find ~/record -type f -mtime +3 | xargs rm -rvf
fi
done
|