TelegramMessenger / MTProxy

5.01k stars 830 forks source link

SIGHUP handler for reloading config #316

Open dvershinin opened 5 years ago

dvershinin commented 5 years ago

Adds SIGHUP handler for on the fly config reload. Fixes #46.

To check, kill -s HUP <mtproxy-pid>.

Result:

[24061][2019-06-28 04:04:51.292265 local] configuration file /usr/share/mtproxy/proxy-multi.conf re-read successfully (68 bytes parsed), new configuration active [24061][2019-06-28 04:04:51.292270 local] Creating NEW connection to x.x.x.x:8888

Then in e.g. SystemD service, add:

[Service]
...
ExecReload=/bin/kill -s HUP $MAINPID

Result is being able to reload config after updating proxy file via systemctl reload mtproxy.