Explorar el Código

handle SIGINT

encrypt hace 9 años
padre
commit
197a9c5708
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      etherswitch.sh

+ 5 - 1
etherswitch.sh

@@ -1,5 +1,6 @@
 #!/bin/env bash
 
+conf=~/.etherswitch
 switch_state=0
 
 function check_fn {
@@ -9,7 +10,10 @@ function check_fn {
     }
 }
 
-source ~/.etherswitch
+source $conf
+
+# handle SIGTERM
+trap 'exit' 15
 
 if [ -z "$device" ]
 then