소스 검색

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