Skip to content

Commit

Permalink
restart overtls service every day
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Sep 7, 2024
1 parent 584ea1d commit 78cb57a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions install/overtls-install-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,13 @@ EOF
judge "cron scheduled task update"
}

function cron_random_restart_overtls_svc() {
local random_hour=$(od -An -N1 -i /dev/urandom | awk '{print $1 % 24}')
local random_minute=$(od -An -N1 -i /dev/urandom | awk '{print $1 % 60}')

(crontab -l; echo "${random_minute} ${random_hour} * * * systemctl restart overtls") | crontab -
}

function nginx_web_server_config_end() {
rm -rf ${nginx_conf_file}
cat > ${nginx_conf_file} <<EOF
Expand Down Expand Up @@ -733,6 +740,8 @@ function install_overtls_remote_server() {
exit 1
fi

cron_random_restart_overtls_svc

echo
echo "======== config.json ========"
echo
Expand Down
9 changes: 9 additions & 0 deletions install/overtls-install-selfsign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,13 @@ function print_url() {
echo "${qrcode}"
}

function cron_random_restart_overtls_svc() {
local random_hour=$(od -An -N1 -i /dev/urandom | awk '{print $1 % 24}')
local random_minute=$(od -An -N1 -i /dev/urandom | awk '{print $1 % 60}')

(crontab -l; echo "${random_minute} ${random_hour} * * * systemctl restart overtls") | crontab -
}

function install_overtls_remote_server() {
check_system
dependency_install
Expand Down Expand Up @@ -530,6 +537,8 @@ function install_overtls_remote_server() {
exit 1
fi

cron_random_restart_overtls_svc

echo
echo "======== config.json ========"
echo
Expand Down

0 comments on commit 78cb57a

Please sign in to comment.