install-zammad-systemd-services.sh 707 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. #
  3. # enable zammad systemd services
  4. #
  5. ZAMMAD_ENV_DIR="/etc/zammad"
  6. SYSTEMD_SERVICE_DIR="/etc/systemd/system"
  7. if [ "$(whoami)" != 'root' ]; then
  8. echo "you need to be root to run this script!"
  9. exit 1
  10. fi
  11. test -d ${ZAMMAD_ENV_DIR} || mkdir -p ${ZAMMAD_ENV_DIR}
  12. test -d ${SYSTEMD_SERVICE_DIR} || mkdir -p ${SYSTEMD_SERVICE_DIR}
  13. cp zammad.env ${ZAMMAD_ENV_DIR}
  14. cp zammad.service zammad-web.service zammad-worker.service zammad-websocket.service ${SYSTEMD_SERVICE_DIR}
  15. # Remove renamed services if they exist.
  16. rm -f "${SYSTEMD_SERVICE_DIR}/zammad-scheduler.service"
  17. rm -f "${SYSTEMD_SERVICE_DIR}/zammad-rails.service"
  18. systemctl daemon-reload
  19. systemctl enable zammad
  20. systemctl start zammad