0

We have configures our stunnel properly in Ubuntu 16.04 , also it is starting properly we are getting our data in application which comes from stunnel server. Although I cannot find any proper way to stop stunnel. I tried killing the pid of stunnel , but killing pid is not a proper way to stop.

Thanks

2 Answers2

2

There are could be several of stunnel processes:

[root@someserver ~]# ps aux | grep stunnel | grep -v grep | awk '{print $2}'
13527
13528
13529
13530
13531
13532

The following bash-one-line loop could handle to kill them all:

if kill $(ps aux | grep stunnel | grep -v grep | awk '{print $2}'); then echo "Done"; else echo "No ps left"; fi
Almaz Gareev
  • 181
  • 1
  • 4
0

Killing the PID sounds pretty bad, but it is the common way to stop processes in linux. "Kill" is just another name for "send signal". If you issue a kill $pid, then a SIGTERM is sent to that process. The process can then handle the signal and perform a clean shutdown. This is also the way many programs implement a configuration reloading functionality, they often use SIGHUP for that (kill -SIGHUP $pid).

So, as long as you don't use kill -SIGKILL $pid (or in short: kill -9 $pid) the program can handle that signal and gracefully shutdown.

More about signals on linux: https://en.wikipedia.org/wiki/Signal_(IPC)#List_of_signals

bratkartoffel
  • 1,127
  • 1
  • 13
  • 37