#!/bin/bash # info: adding cronjob for letsencrypt cetificate installation # options: USER DOMAIN [ALIASES] # # example: v-schedule-letsencrypt-domain admin example.com www.example.com # # This function adds cronjob for letsencrypt ssl certificate installation #----------------------------------------------------------# # Variables & Functions # #----------------------------------------------------------# # Argument definition user=$1 domain=$2 aliases=$3 # Includes # shellcheck source=/etc/hestiacp/hestia.conf source /etc/hestiacp/hestia.conf # shellcheck source=/usr/local/hestia/func/main.sh source $HESTIA/func/main.sh # shellcheck source=/usr/local/hestia/func/domain.sh source $HESTIA/func/domain.sh # load config file source_conf "$HESTIA/conf/hestia.conf" #----------------------------------------------------------# # Verifications # #----------------------------------------------------------# check_args '2' "$#" 'USER DOMAIN [ALIASES]' is_format_valid 'user' 'domain' 'aliases' is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM' is_system_enabled "$WEB_SSL" 'SSL_SUPPORT' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" is_object_valid 'web' 'DOMAIN' "$domain" is_object_unsuspended 'web' 'DOMAIN' "$domain" # Perform verification if read-only mode is enabled check_hestia_demo_mode #----------------------------------------------------------# # Action # #----------------------------------------------------------# # Parsing domain aliases if [ -z "$aliases" ]; then get_domain_values 'web' aliases="$ALIAS" fi # Adding cronjob scheduler for LE $BIN/v-add-cron-letsencrypt-job # Adding LE task echo "$BIN/v-add-letsencrypt-domain $user $domain '$aliases' no yes" \ >> $HESTIA/data/queue/letsencrypt.pipe #----------------------------------------------------------# # Hestia # #----------------------------------------------------------# # Logging log_event "$OK" "$ARGUMENTS" exit