diff --git a/ecosystem.config.js.template b/ecosystem.config.js.template index 4c51376..38fd4f4 100644 --- a/ecosystem.config.js.template +++ b/ecosystem.config.js.template @@ -4,15 +4,15 @@ module.exports = { name: '-email', script: 'index.js', instances: 1, - autorestart: true, - watch: true, + autorestart: false, + watch: false, + cron_restart: "*/15 * * * *", max_memory_restart: '1G', env: { NODE_ENV: 'development', PGUSER: '', PGPASSWORD: '', SCHEMA: '', - KEY: '', BASE_URL: '' EMAIL_FROM: '', // See https://nodemailer.com/smtp/ for all options @@ -26,7 +26,6 @@ module.exports = { PGUSER: '', PGPASSWORD: '', SCHEMA: '', - KEY: '', BASE_URL: '' EMAIL_FROM: '', // See https://nodemailer.com/smtp/ for all options diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..4ec2a5c --- /dev/null +++ b/start.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +while getopts ":i:e:" opt; do + case $opt in + i) instance="$OPTARG" + ;; + e) env="$OPTARG" + ;; + \?) echo "Invalid option -$OPTARG" >&2 + exit + ;; + esac +done + +INST_LEN=$(echo -n $instance | wc -m) +ENV_LEN=$(echo -n $env | wc -m) + +if [[ $INST_LEN == 0 || $ENV_LEN == 0 ]] +then + echo "Invalid parameters passed, must pass -i -e " + exit +fi + +echo Paste key, then press enter + +read key + +KEY_LEN=$(echo -n $key | wc -m) + +if [[ $KEY_LEN = 0 ]] +then + echo "Invalid key passed" +fi + +KEY=$key pm2 start --only $instance --env $env \ No newline at end of file