summaryrefslogtreecommitdiff
path: root/daemon.sh
blob: 1d4965a35081a6613dcb1e93503809d8d92a29e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
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