diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-06-21 21:44:46 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-06-21 21:44:46 -0400 |
commit | 896161c483ceef3ed16e2f19a5c05106bed04512 (patch) | |
tree | 8e79f92d7b3dfe09fa97f4ae5feb8331ad6fbb52 /daemon.sh |
I can't believe I didn't have this in git before.
Diffstat (limited to 'daemon.sh')
-rw-r--r-- | daemon.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/daemon.sh b/daemon.sh new file mode 100644 index 0000000..1d4965a --- /dev/null +++ b/daemon.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +TMP=${TMPDIR-/tmp}/daemon + +running=$(ps -u `whoami` -U `whoami` -o comm|grep -- "$1") +if [ -z "$running" ]; then + mkdir -p "$TMP" + echo "daemon: starting $1" + nohup $@ > "$TMP/$1.out" 2> "$TMP/$1.err" & +else + echo "daemon: $1 is already running" +fi
\ No newline at end of file |