美文网首页
Docker mysql centos sshd crontab

Docker mysql centos sshd crontab

作者: SkTj | 来源:发表于2019-12-04 11:05 被阅读0次

1、
mkdir -p /mysql/data
mkdir -p /mysql/log
chmod 777 -R /mysql/log
chmod 777 -R /mysql/data

2、

[root@hy1 logrotate.d]# pwd
/etc/logrotate.d
[root@hy1 logrotate.d]# ls nginx php-fpm mysql
mysql nginx php-fpm
[root@hy1 logrotate.d]# cat nginx
/data/nginx/logs/.log {
daily
rotate 7
missingok
notifempty
sharedscripts
postrotate
if [ -f /var/run/nginx.pid ]; then
kill -USR1 cat /var/run/nginx.pid
fi
endscript
}
[root@hy1 logrotate.d]# cat php-fpm
/usr/local/webserver/php/var/log/
.log {
daily
rotate 7
missingok
notifempty
sharedscripts
postrotate
if [ -f /var/run/nginx.pid ]; then
kill -USR1 cat /usr/local/webserver/php/var/run/php-fpm.pid
fi
endscript
}
[root@hy1 logrotate.d]# cat mysql
/home/mysql_slow/mysql_slow.log {
daily
rotate 7
dateext
compress
missingok
#notifempty
sharedscripts
create 644 mysql mysql
postrotate
/data/mysql/bin/mysqladmin flush-logs
endscript
}
最后一个mysql 运行需要指定用户名和密码
或者在my.cnf中加入:
[mysqladmin]
user = root
password = *******

[root@hy1 logrotate.d]# crontab -l
59 23 * * * /usr/sbin/logrotate -f /etc/logrotate.d/nginx
59 23 * * * /usr/sbin/logrotate -f /etc/logrotate.d/php-fpm
59 23 * * * /usr/sbin/logrotate -f /etc/logrotate.d/mysql

相关文章

网友评论

      本文标题:Docker mysql centos sshd crontab

      本文链接:https://www.haomeiwen.com/subject/qzvbbctx.html