summaryrefslogtreecommitdiff
path: root/src/core/libs/lib-misc.sh
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2009-02-22 17:29:59 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2009-02-22 17:29:59 +0100
commit71f5510aaaa20ae5ae9c773dca12028bd96aafdf (patch)
treec3dee60f77a5c2954bf0a9a4e73befd0b916460e /src/core/libs/lib-misc.sh
parentf9126402b343aea8f2766bc16c10577b833b6703 (diff)
parentf4bd7c36b44da0c9a5985868aa8b0183cd4414c8 (diff)
pull in a shitload of fixes and some features from the experimental branch
Diffstat (limited to 'src/core/libs/lib-misc.sh')
-rw-r--r--src/core/libs/lib-misc.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/libs/lib-misc.sh b/src/core/libs/lib-misc.sh
index 29e4c2e..01c291f 100644
--- a/src/core/libs/lib-misc.sh
+++ b/src/core/libs/lib-misc.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# run a process in the background, and log it's stdout and stderr to a specific logfile
@@ -14,7 +14,7 @@ run_background ()
debug "run_background called. identifier: $1, command: $2, logfile: $3"
( \
- touch $RUNTIME_DIR/$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 $RUNTIME_DIR/$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 $RUNTIME_DIR/$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
@@ -62,8 +62,9 @@ check_is_in ()
}
-# cleans up file in the runtime directory who can be deleted
+# cleans up file in the runtime directory who can be deleted, make dir first if needed
cleanup_runtime ()
{
+ mkdir -p $RUNTIME_DIR || die_error "Cannot create $RUNTIME_DIR"
rm -rf $RUNTIME_DIR/.dia* &>/dev/null
-} \ No newline at end of file
+}