Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titleSave as /etc/init.d/termtagger
#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          openTMSTermTagger
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: openTMSTermTagger Start daemon at boot time
# Description:       openTMSTermTagger start and stop script, used by Translate5
### END INIT INFO

USER=www-data
APP=openTMSTermTagger
APP_PATH=/var/www/translate5/application/modules/editor/ThirdParty/XliffTermTagger

case "$1" in
  # Start command
  start)
    echo "Starting $APP"
    /bin/su -m $USER -s /bin/bash -c "cd ${APP_PATH} && ${APP_PATH}/startServer.sh &> /dev/null"
    ;;
  # Stop command
  stop)
    echo "Stopping $APP"
    /bin/su -m $USER -s /bin/bash -c "cd ${APP_PATH} && ${APP_PATH}/stopServer.sh &> /dev/null"
    echo "$APP stopped successfully"
    ;;
   # Restart command
   restart)
        $0 stop
        sleep 5
        $0 start
        ;;
  *)
    echo "Usage: /etc/init.d/$APP {start|restart|stop}"
    exit 1
    ;;
esac

exit 0

...