GoAnywhere MFT Linux: Configure as a Service on Systemd

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
2 posts Page 1 of 1

dbeckman

Posts: 4
Joined: Thu Dec 01, 2016 10:34 am

Post by dbeckman » Thu Apr 06, 2017 3:51 pm
The Linux version of GoAnywhere MFT is packaged as a shell script. The installation manual leaves you with a terse instruction:
You can setup GoAnywhere so it starts automatically when the Linux system is booted. Please refer to your operating system manual for more details on setting up auto-start services. You can execute goanywhere.sh from your startup scripts.
You're then left to your own devices. I figured out how to setup a service unit file for automatically starting GoAnywhere MFT 5.4.3 at system startup on a RHEL7 OS. This will certainly work on Centos 7 and Oracle Linux 7 systems, and should work (with minor modifications?) on any distribution using Systemd.
There is probably room for improvement and I'd love to hear any suggestions, but this has worked well for me.

Create your Systemd unit file. (The name is arbitrary and can be anything ending with .service.):
Code: Select all
touch /etc/systemd/system/goanywhere.service
Apply correct permissions:
Code: Select all
chmod 664 /etc/systemd/system/goanywhere.service
Edit /etc/systemd/system/goanywhere.service as follows:
Code: Select all
[Unit]
Description=GoAnywhere Service
After=network.target

[Service]
Type=forking
# Modify user/group according to whichever user you have setup to run GoAnywhere MFT
User=gasvc
Group=gasvc
WorkingDirectory=/usr/local/Linoma_Software/GoAnywhere
# My executable is a shell rather than the actual shell script, goanywhere.sh.
# This is a workaround for the way goanywhere.sh is written, expecting to be run from the installation directory,
# using a relative path. The executable in a systemd unit file has to include an absolute path. I wanted to avoid
# modifying the shell script to make unit file upgrade-friendly. 
ExecStart=/bin/sh goanywhere.sh start
ExecStop=/bin/sh goanywhere.sh stop
Restart=on-abort

StandardOutput=null
StandardError=null
TimeoutSec=300
# goanywhere.sh is just starting a Tomcat application; this gives you correct exit status
SuccessExitStatus=143

[Install]
WantedBy=default.target
Notify systemd that a new unit file exists by running this:
Code: Select all
systemctl daemon-reload
(You also need to run this after making subsequent changes to the file.)

Enable automatic startup:
Code: Select all
systemctl enable goanywhere.service
Start the service:
Code: Select all
systemctl start goanywhere.service
Check status:
Code: Select all
systemctl status goanywhere.service
Cheers,
Daniel

piotr

Posts: 1
Joined: Mon Jan 29, 2018 6:56 am

Post by piotr » Thu Feb 01, 2018 9:26 am
On Ubuntu 16.04 LTS it also required to enable tomcat.pid for correct shutdown sequence to be triggered. The service Start sequence worked out-of-box.
2 posts Page 1 of 1