Update lego_wrapper.sh

Changed all exits to 0 from 1 - inappropriate to exit with 1
Changes to write all renewal output to file - to track renewal attempts by crontab

Signed-off-by: agboola <agboola@theonasanyas.com>
This commit is contained in:
2025-05-21 14:47:48 +01:00
parent 899e9b8feb
commit d4c0da4a95
+18 -9
View File
@@ -39,12 +39,13 @@ check_dependencies() {
echo "Check compelete"
if [ "$dependency_install" == "yes" ]; then
echo "restart shell session"
exit 1
exit 0
fi
}
check_install_curl() {
if ! command -v curl 2>&1 >/dev/null; then
install_as_sudo
echo 'curl module not installed'
@@ -59,6 +60,7 @@ check_install_curl() {
}
check_install_jq() {
if ! command -v jq 2>&1 >/dev/null; then
install_as_sudo
echo 'jq module not installed'
@@ -73,6 +75,7 @@ check_install_jq() {
}
check_install_go() {
if ! command -v go 2>&1 >/dev/null; then
install_as_sudo
echo 'go module not installed'
@@ -149,7 +152,7 @@ run() {
command+="-d $domain "
done
eval " $command run"
exit 1
exit 0
}
revoke() {
@@ -159,7 +162,7 @@ revoke() {
command+="-d $domain "
done
eval " $command revoke"
exit 1
exit 0
}
renew() {
@@ -169,16 +172,22 @@ renew() {
command+="-d $domain "
done
eval " $command renew"
exit 1
exit 0
}
list() {
eval " $command list"
exit 1
exit 0
}
autorenew() {
###to be used to store output from crontab renewals
LOG_FILE="$CERT_PATH/log"
if [ ! -d $LOG_FILE ]; then
mkdir -p $LOG_FILE
fi
for files in $(find $LEGO_PATH/certificates/*.json -type f); do
IFS=$'\n'
for file in $files; do
@@ -188,7 +197,7 @@ autorenew() {
done
done
exit 1
exit 0
}
@@ -211,7 +220,7 @@ functionlist() {
list
;;
*)
exit 1
exit 0
;;
esac
done
@@ -253,8 +262,8 @@ IFS=","
#cron jobs would be created for renew function
if [ -z "$1" ]; then
functionlist
exit 1
exit 0
else
functionvar $1
exit 1
exit 0
fi