From 5cb52946e51297ac2a4779a159f742e3619f4c6e Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Fri, 12 Dec 2008 22:43:17 +0100 Subject: cleanup stale files on start and stop + long overdue introduction of $RUNTIME_DIR --- src/core/libs/lib-misc.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/core/libs/lib-misc.sh') diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh index fd2ebb8..29e4c2e 100644 --- a/src/core/libs/lib-misc.sh +++ b/src/core/libs/lib-misc.sh @@ -14,7 +14,7 @@ run_background () debug "run_background called. identifier: $1, command: $2, logfile: $3" ( \ - touch /home/arch/aif/runtime/$1-running + touch $RUNTIME_DIR/$1-running debug "run_background starting $1: $2 >>$3 2>&1" [ -f $3 ] && echo -e "\n\n\n" >>$3 echo "STARTING $1 . Executing $2 >>$3 2>&1\n" >> $3; @@ -23,7 +23,7 @@ run_background () read $var_exit <<< $? #TODO: bash complains about 'not a valid identifier' debug "run_background done with $1: exitcode (\$$1_exitcode): "${!var_exit}" .Logfile $3" #TODO ${!var_exit} doesn't show anything --> maybe fixed now echo >> $3 - rm -f /home/arch/aif/runtime/$1-running + rm -f $RUNTIME_DIR/$1-running ) & sleep 2 @@ -36,7 +36,7 @@ wait_for () { [ -z "$1" ] && die_error "wait_for needs an identifier to known on which command to wait!" - while [ -f /home/arch/aif/runtime/$1-running ] + while [ -f $RUNTIME_DIR/$1-running ] do #TODO: follow_progress dialog mode = nonblocking (so check and sleep is good), cli mode (tail -f )= blocking? (so check is probably not needed as it will be done) sleep 1 @@ -60,3 +60,10 @@ check_is_in () done return 1 } + + +# cleans up file in the runtime directory who can be deleted +cleanup_runtime () +{ + rm -rf $RUNTIME_DIR/.dia* &>/dev/null +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf