ssh user@10.10.10.10 '
DELETE=3
COMPRESS=1
LOGS=(
"/usr/local/tomcat9_a/logs/"
"/usr/local/tomcat9_b/logs/"
"/usr/local/tomcat9_c/logs/"
)
for logdir in "${LOGS[@]}"; do
if test -d $logdir
then
echo 'password' | sudo -S find -L $logdir -name "*.bz2" -type f -mtime +${DELETE} | sudo xargs rm -f
echo 'password' | sudo -S find -L $logdir \( \( -name "*.log-*" -or -name "*log*" \) -and ! -name "*.bz2" \) -type f -mtime +${COMPRESS} | sudo xargs bzip2 -f
echo 'password' | sudo -S cat /dev/null > $logdir/catalina.out
fi
done
sudo cat /dev/null > /usr/local/tomcat9_a/logs/api.log
'
ssh sbsystems@10.10.10.10 '
DELETE=3
COMPRESS=1
LOGS=(
"/usr/local/tomcat9_a/logs/"
"/usr/local/tomcat9_b/logs/"
)
for logdir in "${LOGS[@]}"; do
if test -d $logdir
then
sudo find -L $logdir -name "*.bz2" -type f -mtime +${DELETE} | sudo xargs rm -f
sudo find -L $logdir \( \( -name "*.log-*" -or -name "*log*" \) -and ! -name "*.bz2" \) -type f -mtime +${COMPRESS} | sudo xargs bzip2 -f
sudo cat /dev/null > $logdir/catalina.out
fi
done
'
'Infra Structure > Jenkins' 카테고리의 다른 글
[Jenkins] Pipeline 예제(tomcat) try catch (0) | 2022.07.09 |
---|---|
[Jenkins] Pipeline 예제(node.js) (0) | 2022.07.09 |
[Jenkins] docker로 Jenkins 설치 (0) | 2022.07.03 |
[Jenkins] 원격 계정생성 (0) | 2022.06.13 |
[Jenkins] 백업 / 복구 (0) | 2022.06.03 |