diff --git a/lib/bkp b/lib/bkp index 4759313..db5fa24 100644 --- a/lib/bkp +++ b/lib/bkp @@ -1,5 +1,9 @@ #!/bin/bash +# Note: We use $HOME here, because it matches the duply/duplicity profile creation folder. +# The profile folder will be stored under '~/.duply/' (where ~ is the current users home directory). +# Hint: If the folder '/etc/duply' exists, the profiles for the super user root will be searched & created there. + bucket_validation() { local bucketname=$(echo $1 | cut -d "/" -f 1) diff --git a/lib/datadog b/lib/datadog index 6d5c30a..41f90f8 100644 --- a/lib/datadog +++ b/lib/datadog @@ -344,7 +344,7 @@ dd_mysql() { instances: - server: 127.0.0.1 user: admin - pass: '$ADMIN_PASS' + pass: '$( echo $(conf_read mysql-admin) | openssl enc -d -a -salt )' port: \"3306\" options: replication: false diff --git a/lib/general b/lib/general index 0d48dcb..c9f7971 100644 --- a/lib/general +++ b/lib/general @@ -70,9 +70,6 @@ conf_write() { # *********************************************** # Useful variables **************************** # *********************************************** -ADMIN_PASS=$( echo $(conf_read mysql-admin) | openssl enc -d -a -salt ) -[[ -z $ADMIN_PASS ]] && readonly ADMIN_PASS="dUmb" || readonly ADMIN_PASS=$ADMIN_PASS # Never empty, prevent asking password! - # MySQL folder if [[ $(conf_read db-engine) == "mysql" ]]; then readonly MYSQL_CONF_PATH="/etc/mysql/mysql.conf.d" @@ -82,10 +79,14 @@ else readonly MYSQL_CONF_PREF="90" fi -# Current original user HOME even with sudo (root) - This script always run with sudo, so $HOME is always /root -# https://askubuntu.com/questions/1186999/how-does-sudo-handle-home-differently-since-19-10 -readonly CURRENT_HOME=$(eval echo ~${SUDO_USER:-${USER}}) -readonly CURRENT_USER=${SUDO_USER:-${USER}} +# Current LoggedIn User! +if [[ -n $(logname) && -d $(eval echo ~$(logname)) ]]; then # You better double check... + readonly CURRENT_HOME=$(eval echo ~$(logname)) + readonly CURRENT_USER=$(logname) +else + readonly CURRENT_HOME="/root" + readonly CURRENT_USER="root" +fi # Check for BASH Shell # This is a very "shity" method, but checking if file exists is very reliable diff --git a/lib/install b/lib/install index 59c83fc..b56e481 100644 --- a/lib/install +++ b/lib/install @@ -324,6 +324,7 @@ fastcgi_param HTTP_ACCEPT_ENCODING ""; sudo sed -i '/USERGROUPS_ENAB/c \USERGROUPS_ENAB no' /etc/login.defs # Check for dynamic variables. + sudo systemctl restart nginx # We need to kill the process, don't use reload (I don't know why here, but it's needed!) [[ -n $(conf_read default-response) ]] && sudo webinoly -default-site=$(conf_read default-response) [[ -n $(conf_read tools-port-set) ]] && sudo webinoly -tools-port=$(conf_read tools-port-set) [[ -n $(conf_read tools-site) ]] && sudo webinoly -tools-site=$(conf_read tools-site) @@ -380,7 +381,7 @@ location = /xmlrpc.php { conf_write server-version $svr_version conf_write nginx-optim true - sudo systemctl restart nginx # We need to kill the process, don't use reload + sudo systemctl reload nginx api-events_update in10 echo "${gre}Nginx has been successfully Optimized by Webinoly! ${end}" }