Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qg-docker-entrypoints
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
QA
qg-docker-entrypoints
Commits
a83de7cb
Commit
a83de7cb
authored
Apr 27, 2018
by
苗青
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rollback
parent
85139e3a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
run.sh
dev/java/run.sh
+24
-24
No files found.
dev/java/run.sh
View file @
a83de7cb
...
@@ -48,30 +48,30 @@ if [[ $CLUSTER == "3B" ]]; then
...
@@ -48,30 +48,30 @@ if [[ $CLUSTER == "3B" ]]; then
echo
"tail -f
$log_path
/*log"
echo
"tail -f
$log_path
/*log"
tail
-f
$log_path
/
*
log
tail
-f
$log_path
/
*
log
# 安装 crontab TODO apt or yum
#
#
安装 crontab TODO apt or yum
/bin/yum
install
-y
crontabs
#
/bin/yum install -y crontabs
#
# 定时删除日志
#
#
定时删除日志
deleteLogs
()
#
deleteLogs()
{
#
{
daysRetained
=
'10'
#
daysRetained='10'
sysName
=
`
cat
/home/quant_group/build_info |
grep
'SYSTEM_NAME'
|
awk
-F
:
'{print $2}'
`
#
sysName=`cat /home/quant_group/build_info | grep 'SYSTEM_NAME' | awk -F: '{print $2}'`
sysName
=
'xyqb-user2'
#
sysName='xyqb-user2'
crontabCmd
=
"0 1 * * * find "
$log_path
" -mtime +"
$daysRetained
" -name '"
$sysName
".log.*' -exec rm -rf {}
\;
"
#
crontabCmd="0 1 * * * find "$log_path" -mtime +"$daysRetained" -name '"$sysName".log.*' -exec rm -rf {} \;"
tmpCronFile
=
'/tmp/crontab.bak'
#
tmpCronFile='/tmp/crontab.bak'
crontab
-l
&>
$tmpCronFile
#
crontab -l &> $tmpCronFile
currentCrontab
=
`
cat
$tmpCronFile
`
#
currentCrontab=`cat $tmpCronFile`
if
[[
$currentCrontab
==
*
"
$crontabCmd
"
*
]]
#
if [[ $currentCrontab == *"$crontabCmd"* ]]
then
#
then
echo
'task already existed!'
#
echo 'task already existed!'
else
#
else
echo
"
$crontabCmd
"
>>
$tmpCronFile
#
echo "$crontabCmd" >> $tmpCronFile
crontab
$tmpCronFile
#
crontab $tmpCronFile
echo
"add task to crontab!"
#
echo "add task to crontab!"
rm
$tmpCronFile
#
rm $tmpCronFile
fi
#
fi
}
#
}
deleteLogs
#
deleteLogs
else
else
echo
"clean
${
log_path
}
/*"
echo
"clean
${
log_path
}
/*"
...
...
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