Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-04-23 16:58:00 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dbcd7d883b9a34b6a9f7fcb298a5ab3cf68b8daf
dbcd7d88
1 parent
e5099627
add script check_hls_backup.sh to research hls.
显示空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
99 行增加
和
0 行删除
trunk/research/hls/check_hls_backup.sh
trunk/research/hls/check_hls_backup.sh
0 → 100755
查看文件 @
dbcd7d8
if
[[
$#
-lt 2
]]
;
then
echo
"Usage:
$0
<hls0> <hls1> [keep_ts]"
echo
" keep_ts to keep the download ts, default is off"
echo
"For example:"
echo
"
$0
http://192.168.1.137:1980/hls/live/stone/live.m3u8 http://192.168.1.137:1984/hls/live/stone/live.m3u8"
echo
"
$0
http://192.168.1.137:1980/hls/live/livestream/live.m3u8 http://192.168.1.137:1984/hls/live/livestream/live.m3u8"
echo
"
$0
http://ossrs.net:1984/hls/live/livestream/live.m3u8 http://ossrs.net:1996/hls/live/livestream/live.m3u8"
exit
1
fi
hls0
=
$1
hls1
=
$2
keep_ts
=
NO
if
[[
$#
-gt 2
]]
;
then
keep_ts
=
YES
fi
#echo "check hls backup of $hls0 vs $hls1, keep_ts=$keep_ts"
hls0_tss
=
`
curl
$hls0
2>/dev/null |grep
"
\.
ts"
`
hls1_tss
=
`
curl
$hls1
2>/dev/null |grep
"
\.
ts"
`
hls0_prefix
=
`
dirname
$hls0
`
hls1_prefix
=
`
dirname
$hls1
`
work_dir
=
"./hbt_temp_
`
date +%s
`
"
md5_tool
=
"md5"
`
md5sum --version >/dev/null 2>&1
`
&&
md5_tool
=
"md5sum"
#echo "use md5 tool: $md5_tool"
CHECKED
=
NO
OK
=
YES
for
ts
in
$hls0_tss
;
do
match
=
NO
for
ts1
in
$hls1_tss
;
do
if
[[
$ts
==
$ts1
]]
;
then
#echo "check ts $ts"
match
=
YES
break
fi
done
#echo "check ts $ts, match=$match"
if
[
$match
=
NO
]
;
then
echo
"skip
$ts
"
continue
fi
ts0_uri
=
$hls0_prefix
/
$ts
ts1_uri
=
$hls1_prefix
/
$ts
ts0_tmp
=
$work_dir
/hls0/
`
basename
$ts
`
ts1_tmp
=
$work_dir
/hls1/
`
basename
$ts
`
#echo "start check $ts0_uri($ts0_tmp) vs $ts1_uri($ts1_tmp)"
mkdir -p
`
dirname
$ts0_tmp
`
&&
curl
$ts0_uri
>
$ts0_tmp
2>/dev/null
&&
ret
=
$?
;
if
[[
$ret
-ne 0
]]
;
then
echo
"download
$ts0_uri
to
$ts0_tmp
failed. ret=
$ret
"
;
exit
$ret
;
fi
mkdir -p
`
dirname
$ts1_tmp
`
&&
curl
$ts1_uri
>
$ts1_tmp
2>/dev/null
&&
ret
=
$?
;
if
[[
$ret
-ne 0
]]
;
then
echo
"download
$ts1_uri
to
$ts1_tmp
failed. ret=
$ret
"
;
exit
$ret
;
fi
if
[[
$md5_tool
==
"md5"
]]
;
then
ts0_cs
=
`
$md5_tool
$ts0_tmp
|awk
'{print $4}'
`
else
ts0_cs
=
`
$md5_tool
$ts0_tmp
|awk
'{print $1}'
`
fi
#echo "hls0: md5sum($ts0_tmp)=$ts0_cs"
if
[[
$md5_tool
==
"md5"
]]
;
then
ts1_cs
=
`
$md5_tool
$ts1_tmp
|awk
'{print $4}'
`
else
ts1_cs
=
`
$md5_tool
$ts1_tmp
|awk
'{print $1}'
`
fi
#echo "hls1: md5sum($ts1_tmp)=$ts1_cs"
if
[[
$ts0_cs
!
=
$ts1_cs
]]
;
then
echo
"
$ts0_uri
(
$ts0_cs
) not equals to
$ts1_uri
(
$ts1_cs
)"
OK
=
NO
fi
CHECKED
=
YES
done
if
[
$keep_ts
=
NO
]
;
then
#echo "clenaup work dir $work_dir"
rm -rf
$work_dir
else
echo
"keep work dir
$work_dir
"
fi
#echo "====================================================="
if
[[
$OK
=
YES
&&
$CHECKED
=
YES
]]
;
then
echo
"OK"
exit
0
else
echo
"FAILED"
exit
1
fi
exit
0
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论