Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
deploy-script
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
script
deploy-script
Commits
dd191ca7
Commit
dd191ca7
authored
Aug 28, 2020
by
白秀江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新scan_no_ttl.sh
parent
ffa05af0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
scan_no_ttl.sh
scan_no_ttl.sh
+38
-0
No files found.
scan_no_ttl.sh
0 → 100644
View file @
dd191ca7
#!/bin/bash
# redis ip
db_ip
=
127.0.0.1
# redis 端口
db_port
=
6379
# redis 密码
password
=
# 第一次游标
cursor
=
0
# 每次迭代的数量
cnt
=
100
# 下一次游标
new_cursor
=
0
redis-cli
-h
$db_ip
-p
$db_port
scan
$cursor
count
$cnt
>
scan_tmp_result
new_cursor
=
`
sed
-n
'1p'
scan_tmp_result
`
sed
-n
'2,$p'
scan_tmp_result
>
scan_result
cat
scan_result |while
read
line
do
ttl_result
=
`
redis-cli
-h
$db_ip
-p
$db_port
ttl
$line
`
# 获取 key 过期时间
if
[[
$ttl_result
==
-1
]]
;
then
# 判断过期时间,-1 是不过期
echo
$line
>>
no_ttl.log
# 追加到指定文件
fi
done
while
[[
$cursor
!=
$new_cursor
]]
do
redis-cli
-h
$db_ip
-p
$db_port
scan
$new_cursor
count
$cnt
>
scan_tmp_result
new_cursor
=
`
sed
-n
'1p'
scan_tmp_result
`
sed
-n
'2,$p'
scan_tmp_result
>
scan_result
cat
scan_result |while
read
line
do
ttl_result
=
`
redis-cli
-h
$db_ip
-p
$db_port
ttl
$line
`
if
[[
$ttl_result
==
-1
]]
;
then
echo
$line
>>
no_ttl.log
fi
done
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment