Score:-1

Starting appium in Screen using systemd

ke flag

I'm facing an issue with systemctl, where I am not able to start appium tool via systemctl upon startup on my server.

This is the systemctl service I wrote, and I would expect it to be able to start the appium tool inside a screen instance within my machine and detach from it, while leaving it running (hence the -dmS flags).

[Unit]
Description=Start appium 


[Service]
Type=oneshot
RemainAfterExit=no
ExecStart="screen -dmS appium appium"

[Install]
WantedBy=default.target

When the service is started, I see an error on the service logs that it can't find appium in my system. However, if I try to execute it via terminal ($ screen -dmS appium appium), I am able to run it fine.

Any help is highly appreciated. Thank you.

Raffa avatar
jp flag
Use the full path to the executables e.g. `/bin/scrren` and `/bin/appium`
Lorenzo Battilocchi avatar
ke flag
@Raffa still getting a similar error `Failed at step EXEC spawning /usr/bin/screen -dm /usr/local/bin/appium: No such file or directory`. Verified all paths are correct (did a `whereis appium` and `whereis screen` to double check)
Score:0
ke flag

Solution: systemd runs processes in its own "subshell" which it keeps running once the invocation is completed, like a sort of "screen instance".

Therefore, the solution became much simpler than what I was making it out to be:

[Unit]
Description=Start appium 


[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=appium

[Install]
WantedBy=default.target

Passing in appium command straight away worked as a charm. If multiple versions are installed, the command avm use $(VERSION) can also be used (eg avm use 1.7.2 for appium 1.7.2).

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.