Page tree

Versions Compared

Key

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

...

The script "startServer.sh" starts the openTMStermTagger server as shown in Server environment - configure from scratch.

Table of Contents

Control startup with supervisord

Since supervisord is recommended for the WebSocket Server of translate5, it makes sense to control the termtaggers (if they are on the same server) with supervisord too.

There fore use the latest termtagger delivered with translate5 install-and-update script. Add and modify the following example config, thats it.


Code Block
TODO


SysVinit init.d startup script

...

Code Block
languagebash
titleSave as /etc/init.d/openTMSTermTagger
#!/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

 


Make the script executable, add it to the default runlevel and start it directly:

Code Block
languagebash
sudo chmod 755 /etc/init.d/openTMSTermTagger
sudo update-rc.d openTMSTermTagger defaults
sudo /etc/init.d/openTMSTermTagger start

 


SystemD start script

Code Block
languagebash
titleEnsure that the start and stop scripts delivered with translate5 are executable:
sudo chmod u+x /var/www/translate5/application/modules/editor/ThirdParty/XliffTermTagger/startServer.sh
sudo chmod u+x /var/www/translate5/application/modules/editor/ThirdParty/XliffTermTagger/stopServer.sh

...

Code Block
titleCopy the following content into the above generated termtagger.service file
[Unit]
Description=openTMS TermTagger
After=syslog.target network.target


[Service]
Type=forking
User=www-data
Group=www-data
ExecStart=/var/www/translate5/application/modules/editor/ThirdParty/XliffTermTagger/startServer.sh
ExecStop=/var/www/translate5/application/modules/editor/ThirdParty/XliffTermTagger/stopServer.sh
WorkingDirectory=/var/www/translate5/application/modules/editor/ThirdParty/XliffTermTagger/

[Install]
WantedBy=default.target

 


Ensure that the filepaths used in above ExecStart and ExecStop are pointing to the right place! 


Code Block
languagebash
titleRun the following commands to start the termtagger:
sudo systemctl daemon-reload
sudo systemctl start termtagger.service

# to start termtagger automatically on boot:
sudo systemctl enable termtagger.service

...