Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## diff -uw functions.5.2 functions.5.4 --- functions.5.2 2009-11-19 13:58:31.000000000 +0100 +++ functions.5.4 2009-11-19 14:00:31.000000000 +0100 @@ -366,15 +366,17 @@ base=${1##*/} # First try "pidof" + __pids_var_run "$1" "$pid_file" + RC=$? + if [ -z "$pid_file" -a -z "$pid" ]; then # <- this line seems to fix the problem pid="$(__pids_pidof "$1")" # because we have no pidfile if running once + fi if [ -n "$pid" ]; then echo $"${base} (pid $pid) is running..." return 0 fi - # Next try "/var/run/*.pid" files - __pids_var_run "$1" "$pid_file" - case "$?" in + case "$RC" in 0) echo $"${base} (pid $pid) is running..." return 0
This paste will be private.
From the Design Piracy series on my blog: