From f9121d8090357c780356cfc61e3506dfb4c5bdc9 Mon Sep 17 00:00:00 2001 From: sahil-sagwekar2652 Date: Wed, 24 Apr 2024 15:53:59 +0530 Subject: [PATCH] add cronjob for certbot --- cron_job.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cron_job.sh diff --git a/cron_job.sh b/cron_job.sh new file mode 100644 index 0000000..589f3ab --- /dev/null +++ b/cron_job.sh @@ -0,0 +1,12 @@ +# Cleanup exited docker containers +EXITED_CONTAINERS=$(docker ps -a | grep Exited | awk '{ print $1 }') +if [ -z "$EXITED_CONTAINERS" ] +then + echo "No exited containers to clean" +else + docker rm $EXITED_CONTAINERS +fi + +# renew certbot certificate +docker compose run --rm certbot +docker compose exec nginx nginx -s reload