ยง2024-11-01
#! /bin/bash
OURNAME=06_install_enable_services.sh
echo -e "\n-- Executing ${ORANGE}${OURNAME}${NC} subscript --"
NODE_PATH=`command -v node`
# command -v node, if Node.js is installed and available in your PATH, the command will
# return the path to the Node.js executable (e.g., /usr/bin/node). If it's not installed
# or not found in the PATH, it will return nothing
# $ command -v node
# /usr/bin/node
SYSTEMCTL_PATH=`command -v systemctl`
# $ command -v systemctl
# /usr/bin/systemctl
SRS_SECRET=`pwgen 12 -1`
# The command pwgen 12 -1 is used to generate a random password.
# pwgen: This is the command-line utility for generating passwords.
# 12: This specifies the length of the password to be generated. It is 12 characters long.
# -1: This option tells pwgen to generate a single password.
# Without this option, pwgen would generate multiple passwords by default.
DKIM_SECRET=`pwgen 12 -1`
ZONEMTA_SECRET=`pwgen 12 -1`
DKIM_SELECTOR=`$NODE_PATH -e 'console.log(Date().toString().substr(4, 3).toLowerCase() + new Date().getFullYear())'`
# node -e 'console.log(Date().toString().substr(4, 3).toLowerCase() + new Date().getFullYear())'
# nov2024
$SYSTEMCTL_PATH enable mongod.service
$SYSTEMCTL_PATH enable redis-server.service
echo -e "\n-- These are the installed and required programs:"
node -v
redis-server -v
mongod --version
echo "HOSTNAME: $HOSTNAME"
echo -e "-- Installing ${RED}npm globally${NC} (workaround)"
# See issue https://github.com/nodemailer/wildduck/issues/82
npm install npm -g