Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Installing MinimServer on FreeNAS or FreeBSD
11-02-2020, 08:44
Post: #61
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
In this section of code:

Code:
pid="$(cat "${MINIMPIDFILE}" 2>/dev/null)"
if [ -n "$pid" ]; then
    cmdline="$(cat /proc/$pid/cmdline | tr '\0' ' ' 2>/dev/null)"
else
    cmdline=
fi
if [ -z "$cmdline" ]; then
    if [ -s "${OUTFILE}" ]; then
        cat "${OUTFILE}" 1>&2
    else
        echo "Failed to start Minim${WS}" 1>&2
    fi
    exit 1
fi

the startd script is looking for the minimserver.pid file to be non-null and checking whether /proc/$pid/cmdline is also non-null. If the minimserver.pid file is non-null and /proc/$pid/cmdline is null, the "Failed to start" message will be produced.

Does /proc/$pid/cmdline work on BSD? If it doesn't, this would explain the error message.

The other possibility is that the minimserver.pid file is non-null and /proc/$pid/cmdline is null because of some startup sequencing/timing issue. If this is the case, adding a short delay into this check might solve the problem.

I can't check this myself because it is working for me on Linux.
Find all posts by this user
Quote this message in a reply
12-02-2020, 03:30
Post: #62
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
(11-02-2020 08:44)simoncn Wrote:  In this section of code:

Code:
pid="$(cat "${MINIMPIDFILE}" 2>/dev/null)"
if [ -n "$pid" ]; then
    cmdline="$(cat /proc/$pid/cmdline | tr '\0' ' ' 2>/dev/null)"
else
    cmdline=
fi
if [ -z "$cmdline" ]; then
    if [ -s "${OUTFILE}" ]; then
        cat "${OUTFILE}" 1>&2
    else
        echo "Failed to start Minim${WS}" 1>&2
    fi
    exit 1
fi

the startd script is looking for the minimserver.pid file to be non-null and checking whether /proc/$pid/cmdline is also non-null. If the minimserver.pid file is non-null and /proc/$pid/cmdline is null, the "Failed to start" message will be produced.

Does /proc/$pid/cmdline work on BSD? If it doesn't, this would explain the error message.

The other possibility is that the minimserver.pid file is non-null and /proc/$pid/cmdline is null because of some startup sequencing/timing issue. If this is the case, adding a short delay into this check might solve the problem.

I can't check this myself because it is working for me on Linux.

There is no procfs mounted by default on FreeBSD. So I wouldn't count on it, although in my jail it is there as part of some dependency. Nor will this work on a mac. Why not check $(uname) and do something like

Code:
ps auxww | grep minim | grep mserver.jar | awk {print $2}

for *BSD and Darwin?
Find all posts by this user
Quote this message in a reply
12-02-2020, 11:57
Post: #63
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
Thanks for confirming the cause of the problem.

This script is part of the Linux version of MinimServer. As I have said previously, the Linux scripts are not intended to support the Mac.

I cannot add BSD-dependent behaviour to these scripts because I have no way to test or support this.

Your suggestion can give a false positive by matching other MinimServer processes. It is necessary to check for a process that has the specific PID in the minimserver.pid file, perhaps using something like:

ps ww -p $pid

and then extracting the command line from the ps output.

I will not be pursuing this any further as the current code is working correctly on Linux
Find all posts by this user
Quote this message in a reply
12-02-2020, 15:25
Post: #64
RE: [Tutorial] Installing MinimServer on FreeNAS or FreeBSD
Then just tell users to mount procfs. Add that to prerequisites in instructions. On FreeBSD,

Code:
$ mount -t procfs proc /proc

and/or add it to /etc/fstab if it is not there.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)