Skip to content

Instantly share code, notes, and snippets.

@adambyrtek
Created December 14, 2010 13:09
Show Gist options
  • Save adambyrtek/740382 to your computer and use it in GitHub Desktop.
Save adambyrtek/740382 to your computer and use it in GitHub Desktop.
Fix for PID detection in ffp startup scripts
--- /ffp/etc/ffp.subr.orig 2010-12-14 13:52:00 +0100
+++ /ffp/etc/ffp.subr 2010-12-14 14:08:29 +0100
@@ -49,18 +49,18 @@
proc_start()
{
while [ $# -gt 0 ]; do
- _cmd=$(basename $1)
+ _path=$1
+ _cmd=$(basename $_path)
eval _flags=\$$(echo $_cmd | tr '.-' '_')_flags
_pids=$(find_pids $_cmd)
if test -z "$_pids"; then
- test -x "$1" || die "$1: Not executable"
- echo "Starting $1 $_flags"
- $1 $_flags
+ test -x "$_path" || die "$_path: Not executable"
+ echo "Starting $_path $_flags"
+ $_path $_flags
else
warn "$_cmd: Already running"
fi
-
shift 1
done
}
@@ -70,15 +70,17 @@
proc_start_bg()
{
while [ $# -gt 0 ]; do
- _cmd=$(basename $1)
+ _path=$1
+ _cmd=$(basename $_path)
eval _flags=\$$(echo $_cmd | tr '.-' '_')_flags
mkdir -p /ffp/var/log
_log=/ffp/var/log/$(echo $_cmd).log
- _pids=$(find_pids $_cmd)
+ _pids=$(find_pids $_path)
+
if test -z "$_pids"; then
- test -x "$1" || die "$1: Not executable"
- echo "Starting $1 $_flags"
- $1 $_flags 1>$_log 2>&1 </dev/null &
+ test -x "$_path" || die "$_path: Not executable"
+ echo "Starting $_path $_flags"
+ $_path $_flags 1>$_log 2>&1 </dev/null &
else
warn "$_cmd: Already running"
fi
@@ -89,8 +91,9 @@
proc_stop()
{
while [ $# -gt 0 ]; do
- _cmd=$(basename $1)
- _pids=$(find_pids $_cmd)
+ _path=$1
+ _cmd=$(basename $_path)
+ _pids=$(find_pids $_path)
if test -n "$_pids"; then
echo "Stopping $_cmd"
@@ -106,8 +109,9 @@
proc_status()
{
while [ $# -gt 0 ]; do
- _cmd=$(basename $1)
- _pids=$(find_pids $_cmd)
+ _path=$1
+ _cmd=$(basename $_path)
+ _pids=$(find_pids $_path)
if test -n "$_pids"; then
echo "$_cmd running as pid $_pids"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment