diff --git a/alpine/Dockerfile b/alpine/Dockerfile index e666628..67758e8 100644 --- a/alpine/Dockerfile +++ b/alpine/Dockerfile @@ -1,8 +1,8 @@ -FROM alpine:3.17 +FROM alpine:3.20 MAINTAINER Colben colbenlee@gmail.com ADD --chown=root:root /ADD/ /etc/ -RUN echo -e 'https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.17/main\n\ -https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.17/community\n\ +RUN echo -e 'https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.20/main\n\ +https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.20/community\n\ ' > /etc/apk/repositories \ && apk update \ && apk add --no-cache bash curl coreutils iproute2 \ diff --git a/chromedriver/ADD/ccmd b/chromedriver/ADD/ccmd index fc2b5d3..6c34280 100755 --- a/chromedriver/ADD/ccmd +++ b/chromedriver/ADD/ccmd @@ -57,7 +57,7 @@ function Main { # ModifyConf StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/cloudreve/ADD/ccmd b/cloudreve/ADD/ccmd index 81b5ef6..f49b42c 100755 --- a/cloudreve/ADD/ccmd +++ b/cloudreve/ADD/ccmd @@ -82,7 +82,7 @@ function Main { ModifyConf StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/elasticsearch6/ADD/ccmd b/elasticsearch6/ADD/ccmd index 3ec7106..7850f4a 100755 --- a/elasticsearch6/ADD/ccmd +++ b/elasticsearch6/ADD/ccmd @@ -106,7 +106,7 @@ function Main { ChangeSysConf StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/elasticsearch7/ADD/ccmd b/elasticsearch7/ADD/ccmd index 7a49f53..aafd049 100755 --- a/elasticsearch7/ADD/ccmd +++ b/elasticsearch7/ADD/ccmd @@ -146,7 +146,7 @@ function Main { ChangeSysConf StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/gitea/ADD/ccmd b/gitea/ADD/ccmd index 35f0cab..64e8182 100755 --- a/gitea/ADD/ccmd +++ b/gitea/ADD/ccmd @@ -167,7 +167,7 @@ function Main { ChangeOwner StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/greatsql/ADD/ccmd b/greatsql/ADD/ccmd index 476b68a..d3c02b8 100755 --- a/greatsql/ADD/ccmd +++ b/greatsql/ADD/ccmd @@ -32,9 +32,9 @@ function Print { function Quit { Print killing greatsql ... - mysqladmin shutdown || true + greatsqladmin shutdown || true while :; do - pkill -f mysqld && Print killing greatsql ... || break + pkill -f greatsqld && Print killing greatsql ... || break sleep 1 done Print Container stopped. @@ -71,7 +71,7 @@ function ImportInitSql { } function StartProc { - mysqld & + greatsqld & PIDS="$PIDS $!" while sleep 1; do [ -e $SOCK_FILE ] && break || echo -n . @@ -88,7 +88,7 @@ function Main { Init StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/greatsql/Dockerfile-greatsql8 b/greatsql/Dockerfile-greatsql8 index fe2f4be..f960008 100644 --- a/greatsql/Dockerfile-greatsql8 +++ b/greatsql/Dockerfile-greatsql8 @@ -29,7 +29,9 @@ gpgcheck=0\n\ && rm -f /tmp/greatsql-devel* /tmp/greatsql-mysql-router-* \ && rpm -ivh /tmp/greatsql-*.rpm \ && ln -s /usr/bin/mysql /usr/bin/greatsql \ + && ln -s /usr/sbin/mysqld /usr/sbin/greatsqld \ && ln -s /usr/bin/mysqldump /usr/bin/greatsqldump \ + && ln -s /usr/bin/mysqladmin /usr/bin/greatsqladmin \ && rm -rf /usr/sbin/mysqld-debug \ /var/cache/yum \ /var/lib/yum \ @@ -55,10 +57,6 @@ lock-wait-timeout = 3600\n\ open-files-limit = 65535\n\ back-log = 1024\n\ max-connections = 512\n\ -lock-wait-timeout = 3600\n\ -open-files-limit = 65535\n\ -back-log = 1024\n\ -max-connections = 512\n\ max-connect-errors = 1000000\n\ table-open-cache = 1024\n\ table-definition-cache = 1024\n\ diff --git a/kafka/ADD/ccmd b/kafka/ADD/ccmd index bf3139f..313b48b 100755 --- a/kafka/ADD/ccmd +++ b/kafka/ADD/ccmd @@ -65,7 +65,7 @@ function Main { ModifyConf StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/keepalived/ADD/ccmd b/keepalived/ADD/ccmd index 91e89c1..495cbd2 100755 --- a/keepalived/ADD/ccmd +++ b/keepalived/ADD/ccmd @@ -45,7 +45,7 @@ function Main { local pid= StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/kibana/ADD/ccmd b/kibana/ADD/ccmd index 9e5319f..391a8b1 100755 --- a/kibana/ADD/ccmd +++ b/kibana/ADD/ccmd @@ -93,7 +93,7 @@ function Main { ChangeOwner StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/logstash6/ADD/ccmd b/logstash6/ADD/ccmd index 6dcbd6c..0106d8d 100755 --- a/logstash6/ADD/ccmd +++ b/logstash6/ADD/ccmd @@ -73,7 +73,7 @@ function Main { InstallPlugin StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/mariadb/ADD/ccmd b/mariadb/ADD/ccmd index 733401f..141c596 100755 --- a/mariadb/ADD/ccmd +++ b/mariadb/ADD/ccmd @@ -82,7 +82,7 @@ function Main { Init StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/mongodb/ADD/ccmd b/mongodb/ADD/ccmd index 14c7d48..6f46ffa 100755 --- a/mongodb/ADD/ccmd +++ b/mongodb/ADD/ccmd @@ -63,7 +63,7 @@ function Main { Init StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/mysql/ADD/ccmd b/mysql/ADD/ccmd index 28654f8..7657f83 100755 --- a/mysql/ADD/ccmd +++ b/mysql/ADD/ccmd @@ -52,7 +52,7 @@ function Init { function ImportInitSql { local sql_file= sql_files= mysql -e "CREATE USER docker@localhost IDENTIFIED BY 'China_19\$(10)!'" - mysql -e "GRANT SHUTDOWN ON *.* TO docker@localhost" + mysql -e "GRANT RELOAD,SHUTDOWN ON *.* TO docker@localhost" if sql_files="$(ls $LOG_DIR/init_sql/*.sql 2>/dev/null)"; then Print Importing the sql files ... for sql_file in $sql_files; do @@ -63,6 +63,18 @@ function ImportInitSql { fi } +function SideCar { + local day= last_day=$(date +%d) + while sleep 8; do + day=$(date +%d) \ + && [ "$day" != "$last_day" ] \ + && last_day=$day \ + && find $LOG_DIR -type f -name "*.log" \ + | xargs -I ^ mv -f ^ ^.$(date +%F -d yesterday) \ + && mysqladmin flush-logs + done +} + function StartProc { Print Starting mysql ... mysqld -u mysql & @@ -73,6 +85,8 @@ function StartProc { done echo [ -z "$INIT_FLAG" ] || ImportInitSql + SideCar & + PIDS="$PIDS $!" Print MySQL is ready for connections. } @@ -81,7 +95,7 @@ function Main { Init StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/nginx-1.20.2/ADD/ccmd b/nginx-1.20.2/ADD/ccmd index f8f8860..5b34cc6 100755 --- a/nginx-1.20.2/ADD/ccmd +++ b/nginx-1.20.2/ADD/ccmd @@ -79,7 +79,7 @@ function Main { ChangeOwner StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/nginx-php-7.4/ADD/ccmd b/nginx-php-7.4/ADD/ccmd index 9b9780f..ad05da9 100755 --- a/nginx-php-7.4/ADD/ccmd +++ b/nginx-php-7.4/ADD/ccmd @@ -84,7 +84,7 @@ function Main { ChangeOwner StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/nginx-php-8.1/ADD/ccmd b/nginx-php-8.1/ADD/ccmd index 6c92bf5..21ab2dc 100755 --- a/nginx-php-8.1/ADD/ccmd +++ b/nginx-php-8.1/ADD/ccmd @@ -84,7 +84,7 @@ function Main { ChangeOwner StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/nginx/ADD/ccmd b/nginx/ADD/ccmd index f8f8860..f15bbfb 100755 --- a/nginx/ADD/ccmd +++ b/nginx/ADD/ccmd @@ -47,7 +47,7 @@ function SideCar { local day= last_day=$(date +%d) local md5= last_md5=$(find /etc/nginx/ -type f -name "*.conf" \ | xargs -I ^ md5sum ^ | md5sum) - while sleep 10; do + while sleep 8; do day=$(date +%d) \ && [ "$day" != "$last_day" ] \ && last_day=$day \ @@ -79,7 +79,7 @@ function Main { ChangeOwner StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/prometheus/ADD/ccmd b/prometheus/ADD/ccmd index 13c47eb..b1735e0 100755 --- a/prometheus/ADD/ccmd +++ b/prometheus/ADD/ccmd @@ -240,7 +240,7 @@ function Main { Init StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/redis/ADD/ccmd b/redis/ADD/ccmd index d744bee..a84bd84 100755 --- a/redis/ADD/ccmd +++ b/redis/ADD/ccmd @@ -135,7 +135,7 @@ function Main { Init StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/rsync/ADD/ccmd b/rsync/ADD/ccmd index bedcf83..f174ac1 100755 --- a/rsync/ADD/ccmd +++ b/rsync/ADD/ccmd @@ -49,7 +49,7 @@ function Main { local pid= StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/svn/ADD/ccmd b/svn/ADD/ccmd index 562b8b4..6752816 100755 --- a/svn/ADD/ccmd +++ b/svn/ADD/ccmd @@ -51,7 +51,7 @@ function Main { local pid= StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/tomcat/ADD/ccmd b/tomcat/ADD/ccmd index 789fa3a..f62e213 100755 --- a/tomcat/ADD/ccmd +++ b/tomcat/ADD/ccmd @@ -55,7 +55,7 @@ function Main { RestoreConf StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/vsftpd/ADD/ccmd b/vsftpd/ADD/ccmd index c8c57ac..e91a0b2 100755 --- a/vsftpd/ADD/ccmd +++ b/vsftpd/ADD/ccmd @@ -65,7 +65,7 @@ function Main { CreateFtpUser StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/xxl-job/ADD/ccmd b/xxl-job/ADD/ccmd index aac82cb..f54e08a 100755 --- a/xxl-job/ADD/ccmd +++ b/xxl-job/ADD/ccmd @@ -59,7 +59,7 @@ function Main { ModifyConf StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/zabbix/ADD/ccmd b/zabbix/ADD/ccmd index 3874b64..49dd928 100755 --- a/zabbix/ADD/ccmd +++ b/zabbix/ADD/ccmd @@ -158,7 +158,7 @@ function Main { InitDB StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done diff --git a/zookeeper/ADD/ccmd b/zookeeper/ADD/ccmd index a50bbc4..988c1b9 100755 --- a/zookeeper/ADD/ccmd +++ b/zookeeper/ADD/ccmd @@ -72,7 +72,7 @@ function Main { ModifyConf StartProc trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM - while [ -z "$GOT_SIGTERM" ] && sleep 1; do + while [ -z "$GOT_SIGTERM" ] && sleep 2; do for pid in $PIDS; do [ ! -e /proc/$pid ] && Print Unexpected error! && exit done