diff options
author | Robin Obůrka <r.oburka@gmail.com> | 2016-07-24 17:45:14 +0200 |
---|---|---|
committer | Robin Obůrka <r.oburka@gmail.com> | 2016-07-24 17:45:14 +0200 |
commit | 9eeb500a922f3df831ec564a28262ec60e9a8d73 (patch) | |
tree | 34a0a15030c091d1af56051fbdc275e7e96027b6 /backuper.sh | |
parent | Fix setters (diff) | |
download | backuper-9eeb500a922f3df831ec564a28262ec60e9a8d73.tar.xz |
Check if PIDs file exists
Diffstat (limited to 'backuper.sh')
-rw-r--r-- | backuper.sh | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/backuper.sh b/backuper.sh index 9324b0c..95e3c25 100644 --- a/backuper.sh +++ b/backuper.sh @@ -148,11 +148,13 @@ error_handler() { cleanup() { trap - EXIT INT QUIT TERM HUP ILL TRAP BUS FPE SEGV - for PID in $(cat "$RUNDIR"/"$PID_FILE"); do - if ps --ppid $$ | grep -q "$PID"; then - kill "$PID" - fi - done + if [ -f "$RUNDIR"/"$PID_FILE" ]; then + for PID in $(cat "$RUNDIR"/"$PID_FILE"); do + if ps --ppid $$ | grep -q "$PID"; then + kill "$PID" + fi + done + fi [ -n "$PID_GENERATE" ] && if ps --ppid $$ | grep -q "$PID_GENERATE"; then kill "$PID_GENERATE" |