aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2016-07-24 17:45:14 +0200
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2016-07-24 17:45:14 +0200
commit9eeb500a922f3df831ec564a28262ec60e9a8d73 (patch)
tree34a0a15030c091d1af56051fbdc275e7e96027b6
parentFix setters (diff)
downloadbackuper-9eeb500a922f3df831ec564a28262ec60e9a8d73.tar.xz
Check if PIDs file exists
-rw-r--r--backuper.sh12
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"