Sketch of situation
I am running a small game server, openttd, on my (headless) raspberry pi 3B. I have been able to play this game, with a huge map, so resources are fine (if you don't mind waiting a bit).
Everytime I run a game, i do so with openttd -D -f
to create a new game, and keep it running after i close my SSH connection. Everytime I close a game, i look up the games PID, kill the process, and if I want another game, i start a new one.
Since all that was going smoothly, i decided it was time to automate that repetitive cycle a bit.
I started out by filtering the PID of the first command that contained "openttd" out of the ps aux
command, like this: ps aux | grep "openttd" | tr -s " " | cut -s -d " " -f 2 | head -n 1
. Although not optimal, it works for me. When I tried to test it however, it didn't find any games. When I investigated this, i noticed the following:
My specific problem
Running the command openttd -D -f
completes instantly, and with no output. (It should take some time to calculate stuff).
when running openttd -D -f && tail -f ~/.openttd/openttd.cfg
nothing happens.
if i run ps aux | grep openttd
I don't find any processes.
If i run the command openttd -h
which should show (brief) help info, I get no output, and the command completes instantly.
The command is in my path, and is executable. I don't think I changed any config since it ran successfully. I am able to access the man page of the command, and it looks the same as usual.
My generalized question
How do you deal with a command that misbehaves as I described above?
What are things that should be checked?
What are possible causes for this situation?
type openttd
orwhich openttd
give?