Zah
Zah

Reputation: 6804

Run a detached process with fabric and screen

According to the FAQ, from the recommended ways to run a detached process, the only one that works for me is screen since I cannot install programs on the server and can't seem to make nohup work. I would like to:

No combination of nohup redirections and screen -md command has worked for me so far.

In particular, running this command line does work when executed directly on the server but not trough the run function of fabric. I believe the process is closed when the function returns and I have no time to see it:

nohup /opt/logstash/bin/logstash agent -f /home/unicryo/PVSS_projects/GenerateErrors/logstash_conf/logstash-config-minimum.cfg >> test.out 2>&1 &

Upvotes: 2

Views: 1790

Answers (1)

user559633
user559633

Reputation:

You have been unable to nohup the process because it's not really supported by Fabric.

I'd strongly advise running this command via a process manager (see Fabric's documentation suggestions) because it's far easier to manage (e.g. service logstash stop versus finding the running command in a screen session) and cleaner, but you should be able to get away with something like the following via Fabric:

run("screen -d -m '/opt/logstash/bin/logstash agent -f /home/unicryo/PVSS_projects/GenerateErrors/logstash_conf/logstash-config-minimum.cfg'")

Upvotes: 1

Related Questions