浏览代码

handle SIGINT

encrypt 9 年之前
父节点
当前提交
197a9c5708
共有 1 个文件被更改,包括 5 次插入1 次删除
  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