I have been trying to get a service file setup for our software so that it can be started and stopped. When I manually run the commands, the server starts normal. I next took this an implemented this into a bash script and it also starts normal. The bash script:
#!/bin/bash
/bin/cd /opt/software/test/; source software_env.sh
export TEST_APP="/opt/software/testapp"
/bin/cd /opt/sotware/test/bin/; startserver
I tried to just implement those commands into a system file, but cannot seem to get it write. So the next thing I tried was to leave the bash script and call it from a system file that looked like:
[Unit]
Description=Test Service
[Service]
Type=forking
ExecStart=/opt/software/test/test.startup
[Install]
WantedBy=multi-user.target
I have also tried setting the servive type as Type=simple but that also does not work.
I can successfully start the server by running the bash script via cron at reboot, but if there is a way to get that bash script into a service file that is ultimately what I am looking to do.
The difficulty appears to be getting the source and export to work properly in the unit file. I also noticed some strange behavior when I was getting the bash script to work, that running: source /opt/software/test/software_env.sh instead of /bin/cd /opt/software/test/; source software_env.sh does not work.
The error from systemd reguardless of the different techniques to try to get it to run have all given this error.
test.service - Test service
Loaded: bad-setting (Reason: Unit test.service has a bad unit file setting.)
Active: failed (Result: exit-code)
Main PID: 2778 (code=exited, status)
Thank you for any and all suggestions.