I'm extremely new to systemd and am trying to write a .service file that runs my php script. The script runs and needs to wait for input from someone else to do anything, and remains open til I ctrl-C.
edit: placed this here for clarity on my issue
This service exits immediately after start unless the RemainAfterExit option is set to true. The exit code is 203. With RemainAfterExit, it does not exit but never is running. I am at a loss, I'm afraid.
Here is a generalized version of what I have:
[Unit]
Description=foo
Wants=foo.service
[Service]
WorkingDirectory=/home/foo/bar
RemainAfterExit=true
ExecStart=/home/foo/bar/foo.php
Restart=on-failure
[Install]
WantedBy=multi-user-.target
What I want to do:
Start the php script after another required service (Wants/After?)
Keep the php script running, either in a terminal window or the background (simple/forking?)
Don't exit. Restart if it crashes (on-failure). If I want it always to be running, is always appropriate?
If possible, I would prefer reasoning why this service is written poorly/incorrectly and what I need to do instead of fixed code. Links are especially welcome as I'm learning.