From d035380bd1f3d6d9ab7a19f27feb58dfcd5516aa Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 25 Mar 2015 19:56:56 +0000 Subject: [PATCH] systemd init for mediagoblin --- src/freedombone | 63 ++++++++++++++++--------------------------------- 1 file changed, 20 insertions(+), 43 deletions(-) diff --git a/src/freedombone b/src/freedombone index a9aa6bff..80d22a82 100755 --- a/src/freedombone +++ b/src/freedombone @@ -8461,49 +8461,26 @@ function install_mediagoblin { CURRENT_DDNS_DOMAIN=$MEDIAGOBLIN_DOMAIN_NAME add_ddns_domain - - # TODO... - - - - - # systemd init scripts - - echo '[Unit]' > /etc/systemd/system/gmg.service - echo 'Description=Mediagoblin' >> /etc/systemd/system/gmg.service - echo '' >> /etc/systemd/system/gmg.service - echo '[Service]' >> /etc/systemd/system/gmg.service - echo 'Type=forking' >> /etc/systemd/system/gmg.service - echo 'User=mediagoblin' >> /etc/systemd/system/gmg.service - echo 'Group=mediagoblin' >> /etc/systemd/system/gmg.service - echo '#Environment=CELERY_ALWAYS_EAGER=true' >> /etc/systemd/system/gmg.service - echo 'Environment=CELERY_ALWAYS_EAGER=false' >> /etc/systemd/system/gmg.service - echo "WorkingDirectory=$MEDIAGOBLIN_PATH" >> /etc/systemd/system/gmg.service - echo "ExecStart=$MEDIAGOBLIN_PATH_BIN/paster serve $MEDIAGOBLIN_PATH/paste_local.ini --pid-file=/var/run/mediagoblin/paster.pid --log-file=/var/log/nginx/mediagoblin_paster.log --daemon --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543" >> /etc/systemd/system/gmg.service - echo "ExecStop=$MEDIAGOBLIN_PATH_BIN/paster serve --pid-file=/var/run/mediagoblin/paster.pid $MEDIAGOBLIN_PATH/paste_local.ini stop" >> /etc/systemd/system/gmg.service - echo 'PIDFile=/var/run/mediagoblin/mediagoblin.pid' >> /etc/systemd/system/gmg.service - echo '' >> /etc/systemd/system/gmg.service - echo '[Install]' >> /etc/systemd/system/gmg.service - echo 'WantedBy=multi-user.target' >> /etc/systemd/system/gmg.service - - - echo '[Unit]' > /etc/systemd/system/gmg-celeryd.service - echo 'Description=Mediagoblin Celeryd' >> /etc/systemd/system/gmg-celeryd.service - echo '' >> /etc/systemd/system/gmg-celeryd.service - echo '[Service]' >> /etc/systemd/system/gmg-celeryd.service - echo 'User=mediagoblin' >> /etc/systemd/system/gmg-celeryd.service - echo 'Group=mediagoblin' >> /etc/systemd/system/gmg-celeryd.service - echo 'Type=simple' >> /etc/systemd/system/gmg-celeryd.service - echo "WorkingDirectory=$MEDIAGOBLIN_PATH" >> /etc/systemd/system/gmg-celeryd.service - echo "Environment='MEDIAGOBLIN_CONFIG=$MEDIAGOBLIN_PATH/mediagoblin_local.ini' CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_celery" >> /etc/systemd/system/gmg-celeryd.service - echo "ExecStart=$MEDIAGOBLIN_PATH_BIN/celeryd" >> /etc/systemd/system/gmg-celeryd.service - echo 'PIDFile=/var/run/mediagoblin/mediagoblin-celeryd.pid' >> /etc/systemd/system/gmg-celeryd.service - echo '' >> /etc/systemd/system/gmg-celeryd.service - echo '[Install]' >> /etc/systemd/system/gmg-celeryd.service - echo 'WantedBy=multi-user.target' >> /etc/systemd/system/gmg-celeryd.service - - systemctl start gmg.service - systemctl start gmg-celeryd.service + # init with systemd + echo '[Unit]' > /etc/systemd/system/mediagoblin.service + echo 'Description=Mediagoblin (Media Server)' >> /etc/systemd/system/mediagoblin.service + echo 'After=syslog.target' >> /etc/systemd/system/mediagoblin.service + echo 'After=network.target' >> /etc/systemd/system/mediagoblin.service + echo 'After=postgresql.service' >> /etc/systemd/system/mediagoblin.service + echo '' >> /etc/systemd/system/mediagoblin.service + echo '[Service]' >> /etc/systemd/system/mediagoblin.service + echo 'Type=simple' >> /etc/systemd/system/mediagoblin.service + echo 'User=mediagoblin' >> /etc/systemd/system/mediagoblin.service + echo 'Group=mediagoblin' >> /etc/systemd/system/mediagoblin.service + echo 'WorkingDirectory=/home/mediagoblin/mediagoblin' >> /etc/systemd/system/mediagoblin.service + echo 'ExecStart=/home/mediagoblin/mediagoblin/lazyserver.sh --server-name=broadcast' >> /etc/systemd/system/mediagoblin.service + echo 'Restart=always' >> /etc/systemd/system/mediagoblin.service + echo 'Environment="USER=mediagoblin","HOME=/home/mediagoblin"' >> /etc/systemd/system/mediagoblin.service + echo '' >> /etc/systemd/system/mediagoblin.service + echo '[Install]' >> /etc/systemd/system/mediagoblin.service + echo 'WantedBy=multi-user.target' >> /etc/systemd/system/mediagoblin.service + systemctl enable mediagoblin + systemctl restart mediagoblin echo 'install_mediagoblin' >> $COMPLETION_FILE }