Warum erstellt mein Vorgesetzter viele der gleichen Prozesse?

350
Sayakiss

Config:

[program:aws-mysql] command=ssh -NCf -L 13306:host1:3306 user@host2 directory=/var/www/ECAME user=root autorestart=true exitcodes=0 

Status:

# systemctl status supervisord.service ● supervisord.service - Process Monitoring and Control Daemon Loaded: loaded (/usr/lib/systemd/system/supervisord.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2018-04-15 15:13:22 CST; 24min ago Process: 437 ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf (code=exited, status=0/SUCCESS) Main PID: 502 (supervisord) CGroup: /system.slice/supervisord.service ├─ 502 /usr/bin/python /usr/bin/supervisord -c /etc/supervisord.conf ├─1892 ssh -NCf -L 13306:host1:3306 user@host2 ├─1926 ssh -NCf -L 13306:host1:3306 user@host2 ├─1947 ssh -NCf -L 13306:host1:3306 user@host2 ├─1967 ssh -NCf -L 13306:host1:3306 user@host2 ├─1996 ssh -NCf -L 13306:host1:3306 user@host2 ├─2008 ssh -NCf -L 13306:host1:3306 user@host2 ├─2037 ssh -NCf -L 13306:host1:3306 user@host2 ├─2067 ssh -NCf -L 13306:host1:3306 user@host2 ├─2078 ssh -NCf -L 13306:host1:3306 user@host2 ├─2111 ssh -NCf -L 13306:host1:3306 user@host2 ├─2122 ssh -NCf -L 13306:host1:3306 user@host2 ├─2160 ssh -NCf -L 13306:host1:3306 user@host2 ├─2180 ssh -NCf -L 13306:host1:3306 user@host2 ├─2210 ssh -NCf -L 13306:host1:3306 user@host2 ├─2248 ssh -NCf -L 13306:host1:3306 user@host2 ├─2260 ssh -NCf -L 13306:host1:3306 user@host2 ... a lot of " ssh -NCf -L 13306:host2:3306 user@host2" 

Also, warum supervisorderstellen Sie viele der gleichen Prozesse? Ich denke, es sollte nur einen geben ssh -NCf -L 13306:host2:3306 user@host2.

1
Sie haben das `-f`-Flag gesetzt, wodurch` ssh` Gabel wird. Das erwartet nicht "Supervisord". Versuchen Sie es ohne diese Flagge. Daniel B vor 6 Jahren 1

1 Antwort auf die Frage

2
Daniel B

Supervisor erwartet, dass die Unterprozesse im Vordergrund bleiben :

Programme, die unter Supervisor ausgeführt werden sollen, sollten sich nicht selbst dämonisieren. Sie sollten stattdessen im Vordergrund ausgeführt werden. Sie sollten sich nicht von dem Terminal lösen, von dem aus sie gestartet werden.

Sie haben sshmit der -fFlagge angefangen, was bedeutet :

Fordert ssh auf, vor der Befehlsausführung in den Hintergrund zu wechseln.

Der Supervisor glaubt, dass das Programm geschlossen ist und nach jeder Drosselung eine neue Instanz startet. Es wird immer so bleiben.

Wenn Sie das -fFlag entfernen, sollte es wie erwartet funktionieren.