1
0

synctl 747 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. SYNAPSE="python -m synapse.app.homeserver"
  3. CONFIGFILE="homeserver.yaml"
  4. PIDFILE="homeserver.pid"
  5. GREEN=$'\e[1;32m'
  6. NORMAL=$'\e[m'
  7. set -e
  8. case "$1" in
  9. start)
  10. if [ ! -f "$CONFIGFILE" ]; then
  11. echo "No config file found"
  12. echo "To generate a config file, run '$SYNAPSE -c $CONFIGFILE --generate-config --server-name=<server name>'"
  13. exit 1
  14. fi
  15. echo -n "Starting ..."
  16. $SYNAPSE --daemonize -c "$CONFIGFILE" --pid-file "$PIDFILE"
  17. echo "${GREEN}started${NORMAL}"
  18. ;;
  19. stop)
  20. echo -n "Stopping ..."
  21. test -f $PIDFILE && kill `cat $PIDFILE` && echo "${GREEN}stopped${NORMAL}"
  22. ;;
  23. restart)
  24. $0 stop && $0 start
  25. ;;
  26. *)
  27. echo "Usage: $0 [start|stop|restart]" >&2
  28. exit 1
  29. esac