I'm trying to use systemd to run a very simple application. Basically, I'm trying to learn how to use systemd. In "/etc/systemd/system/test.service" I have the following script:
# this is a test/dummy service. [Unit] Description=Test Application [Service] SyslogIdentifier=Test_Application Type=oneshot User=foobar Group=foobar ExecStart=/opt/blah/service.sh start ExecStop=/opt/blah/service.sh stop RemainAfterExit=yes [Install] WantedBy=multi-user.target
The service.sh script starts the little c++ application (which basically prints out "hello world" in an infinite loop every 3 seconds and the binary name is literally "test") like so:
exec "./$APPLICATION_NAME" & disown
And every time that I run "systemctl start test.service", this is what I see:
May 07 16:55:25 ruc-rhel-test systemd: Started Test Application.
Now, when I use "ps" to see if the test application is still running, I don't see it. I don't mind if it's chugging along in the background, but I don't see it when I run "ps -ef".
If I use the service.sh script to start/stop the "test" binary, everything works just fine. My question is, how can I just run the service.sh script and that's it? What am I screwing up?