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:
+18
-9
@@ -39,12 +39,13 @@ check_dependencies() {
|
|||||||
echo "Check compelete"
|
echo "Check compelete"
|
||||||
if [ "$dependency_install" == "yes" ]; then
|
if [ "$dependency_install" == "yes" ]; then
|
||||||
echo "restart shell session"
|
echo "restart shell session"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_install_curl() {
|
check_install_curl() {
|
||||||
|
|
||||||
if ! command -v curl 2>&1 >/dev/null; then
|
if ! command -v curl 2>&1 >/dev/null; then
|
||||||
install_as_sudo
|
install_as_sudo
|
||||||
echo 'curl module not installed'
|
echo 'curl module not installed'
|
||||||
@@ -59,6 +60,7 @@ check_install_curl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_install_jq() {
|
check_install_jq() {
|
||||||
|
|
||||||
if ! command -v jq 2>&1 >/dev/null; then
|
if ! command -v jq 2>&1 >/dev/null; then
|
||||||
install_as_sudo
|
install_as_sudo
|
||||||
echo 'jq module not installed'
|
echo 'jq module not installed'
|
||||||
@@ -73,6 +75,7 @@ check_install_jq() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_install_go() {
|
check_install_go() {
|
||||||
|
|
||||||
if ! command -v go 2>&1 >/dev/null; then
|
if ! command -v go 2>&1 >/dev/null; then
|
||||||
install_as_sudo
|
install_as_sudo
|
||||||
echo 'go module not installed'
|
echo 'go module not installed'
|
||||||
@@ -149,7 +152,7 @@ run() {
|
|||||||
command+="-d $domain "
|
command+="-d $domain "
|
||||||
done
|
done
|
||||||
eval " $command run"
|
eval " $command run"
|
||||||
exit 1
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
revoke() {
|
revoke() {
|
||||||
@@ -159,7 +162,7 @@ revoke() {
|
|||||||
command+="-d $domain "
|
command+="-d $domain "
|
||||||
done
|
done
|
||||||
eval " $command revoke"
|
eval " $command revoke"
|
||||||
exit 1
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
renew() {
|
renew() {
|
||||||
@@ -169,16 +172,22 @@ renew() {
|
|||||||
command+="-d $domain "
|
command+="-d $domain "
|
||||||
done
|
done
|
||||||
eval " $command renew"
|
eval " $command renew"
|
||||||
exit 1
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
list() {
|
list() {
|
||||||
eval " $command list"
|
eval " $command list"
|
||||||
exit 1
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
autorenew() {
|
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
|
for files in $(find $LEGO_PATH/certificates/*.json -type f); do
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for file in $files; do
|
for file in $files; do
|
||||||
@@ -188,7 +197,7 @@ autorenew() {
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
exit 1
|
exit 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +220,7 @@ functionlist() {
|
|||||||
list
|
list
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
exit 1
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -253,8 +262,8 @@ IFS=","
|
|||||||
#cron jobs would be created for renew function
|
#cron jobs would be created for renew function
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
functionlist
|
functionlist
|
||||||
exit 1
|
exit 0
|
||||||
else
|
else
|
||||||
functionvar $1
|
functionvar $1
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user