From 8e3a997fcb967402035d999c964a17e92e8296f1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 23 Nov 2017 18:18:09 +0000 Subject: [PATCH] Turn smilodon environment into a script --- src/freedombone-app-smilodon | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/freedombone-app-smilodon b/src/freedombone-app-smilodon index e37fd583..ff2ab964 100755 --- a/src/freedombone-app-smilodon +++ b/src/freedombone-app-smilodon @@ -328,6 +328,19 @@ function install_smilodon { SMILODON_SECRET_KEY="$(create_password 30)$(create_password 30)$(create_password 30)$(create_password 30)" fi + echo '#!/bin/bash' > ${SMILODON_PATH}/run_smilodon.sh + echo "cd ${SMILODON_PATH}" >> ${SMILODON_PATH}/run_smilodon.sh + echo "export smilodon_domain_name=$SMILODON_ONION_HOSTNAME" >> ${SMILODON_PATH}/run_smilodon.sh + echo "export secret_key='$SMILODON_SECRET_KEY'" >> ${SMILODON_PATH}/run_smilodon.sh + echo "export mongodb_username='smilodon'" >> ${SMILODON_PATH}/run_smilodon.sh + echo "export mongodb_password='$SMILODON_ADMIN_PASSWORD'" >> ${SMILODON_PATH}/run_smilodon.sh + echo "export smilodon_admin_address=$MY_EMAIL_ADDRESS" >> ${SMILODON_PATH}/run_smilodon.sh + echo "export MAIL_SERVER='localhost'" >> ${SMILODON_PATH}/run_smilodon.sh + echo "export MAIL_PORT=25" >> ${SMILODON_PATH}/run_smilodon.sh + echo "${SMILODON_PATH}/run_smilodon.sh" >> ${SMILODON_PATH}/run_smilodon.sh + chmod +x ${SMILODON_PATH}/run_smilodon.sh + chown smilodon:smilodon ${SMILODON_PATH}/run_smilodon.sh + echo '[Unit]' > /etc/systemd/system/smilodon.service echo 'Description=Smilodon ActivityPub messenger' >> /etc/systemd/system/smilodon.service echo 'After=network.target mongodb.service' >> /etc/systemd/system/smilodon.service @@ -337,14 +350,9 @@ function install_smilodon { echo 'User=smilodon' >> /etc/systemd/system/smilodon.service echo 'Group=smilodon' >> /etc/systemd/system/smilodon.service echo "WorkingDirectory=${SMILODON_PATH}/" >> /etc/systemd/system/smilodon.service - echo "ExecStart=/usr/bin/python3 run.py" >> /etc/systemd/system/smilodon.service - echo "Environment=smilodon_domain_name=$SMILODON_ONION_HOSTNAME" >> /etc/systemd/system/smilodon.service - echo "Environment=secret_key='$SMILODON_SECRET_KEY'" >> /etc/systemd/system/smilodon.service - echo "Environment=mongodb_username='smilodon'" >> /etc/systemd/system/smilodon.service - echo "Environment=mongodb_password='$SMILODON_ADMIN_PASSWORD'" >> /etc/systemd/system/smilodon.service - echo "Environment=smilodon_admin_address=$MY_EMAIL_ADDRESS" >> /etc/systemd/system/smilodon.service - echo "Environment=MAIL_SERVER='localhost'" >> /etc/systemd/system/smilodon.service - echo "Environment=MAIL_PORT=25" >> /etc/systemd/system/smilodon.service + echo "ExecStart=${SMILODON_PATH}/run_smilodon.sh" >> /etc/systemd/system/smilodon.service + echo 'Restart=on-failure' >> /etc/systemd/system/smilodon.service + echo 'RestartSec=10' >> /etc/systemd/system/smilodon.service echo '' >> /etc/systemd/system/smilodon.service echo '[Install]' >> /etc/systemd/system/smilodon.service echo 'WantedBy=multi-user.target' >> /etc/systemd/system/smilodon.service