Timeline for Stop systemd service by sending command to screen session
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 13, 2018 at 11:26 | comment | added | MOHAMMAD RASIM | @ErikF --open doesn't work with --ui=telnet, it works if it was --ui=swt --open or just --open if the main process already had --ui=swt,see the question update please. | |
| Feb 11, 2018 at 21:26 | comment | added | ErikF | As it's running in a service, you'll never see the console: that's why I only used --ui=telnet. I don't get an error 2 when I stop the service: did you reload the changes using systemctl daemon-reload? If it still doesn't work, try using /bin/bash instead of /bin/sh (and do you have nc available?) And for using SWT, you could try with --ui=telnet --open, but I can't guarantee that (I did the testing on a headless server.) | |
| Feb 11, 2018 at 16:48 | comment | added | MOHAMMAD RASIM | @ErikF I used --ui="console,telnet" in the ExecStart and --shutdown in the ExecStop and this works but I don't know how I can detect if the program is really being ended gracefully, moreover when I want to run the swt ui I get Unable to init server: Could not connect: Connection refused in the journal and the service fails | |
| Feb 11, 2018 at 16:29 | comment | added | MOHAMMAD RASIM | When i stop the service i get this in the journal 19:27:43 raspberrypi systemd[1]: biglybt.service: Control process exited, code=exited status=2 Feb 11 19:27:49 raspberrypi systemd[1]: Stopped BiglyBt daemon. Feb 11 19:27:49 raspberrypi systemd[1]: biglybt.service: Unit entered failed state. Feb 11 19:27:49 raspberrypi systemd[1]: biglybt.service: Failed with result 'exit-code'. and the service enters failed status | |
| Feb 11, 2018 at 12:26 | history | edited | ErikF | CC BY-SA 3.0 | Replaced shutdown entry in service file |
| Feb 11, 2018 at 12:21 | comment | added | ErikF | It appears that the --shutdown option doesn't work in telnet mode. Assuming that the server always uses 57006 (that seems to be the default), I've edited the answer to send a command to gracefully shutdown the server rather than use systemd's termination routine. | |
| Feb 11, 2018 at 11:33 | comment | added | MOHAMMAD RASIM | I tried running the ExecStart command in one terminal and then the ExecStop command in another terminal but the process still running! | |
| Feb 11, 2018 at 11:00 | comment | added | ErikF | That's certainly possible. I've never tried using screen in a service context before, so I'm a little uncertain about how it interacts with systemd. | |
| Feb 11, 2018 at 9:54 | comment | added | sourcejedi | I suspect the other problem was that ExecStop is supposed to be synchronous, i.e. the command specified needs to wait for the service to clean up before it returns. I'm not sure that quitting screen will wait for the contained processes to exit, it probably just closes the PTYs (causing SIGHUP to be sent). | |
| Feb 11, 2018 at 5:32 | history | answered | ErikF | CC BY-SA 3.0 |