PXE icon indicating copy to clipboard operation
PXE copied to clipboard

Starting iVentoy sometimes returns PID=0

Open smileymattj opened this issue 1 year ago • 1 comments

Just a minor issue, because iVentoy is just too good and fast. :)

./iventoy.sh start output: iventoy start SUCCESS PID=0

It seems like it's trying to execute next step too fast. I think it might be exiting before /var/run/iventoy.pid is created. Maybe there can be a very short sleep added at the end of the iventoy/lib/iventoy binary executable before it returns user to the shell. Or maybe there is a better way that avoids using sleep that can verify /var/run/iventoy.pid is populated before exiting. The reason it would be beneficial to be in the executable is if user makes custom script. For example a systemd unit file that doesn't rely on iventoy.sh

I was able to resolve by adding a 10 ms sleep line to iventoy.sh script, but this might not be the best solution:

start() {
    local PID
    local RETVAL
    
    PID=$(iventoy_get_running_pid)
    if [ $PID -ne 0 ]; then
        echo "[ERROR] iventoy is already running. PID=$PID"
        exit 1
    fi

    cd $PROJ_DIR
    $PROC_ENV $PROJ_EXEC
    RETVAL=$?
    /bin/sleep 0.01

After /bin/sleep 0.01 addition to iventoy.sh: iventoy start SUCCESS PID=505

smileymattj avatar Jan 04 '25 03:01 smileymattj

Hey, I have the same problem but even by changing /bin/sleep 0.01 to /bin/sleep 1 just doesn't do the trick. Only thing that does it for me is re-"installing" iVentoy (aka de-tarring the file again, doing the config again and putting the isos again). I'll comment if i find anything new.

reefsofts-rhosds avatar Jun 22 '25 09:06 reefsofts-rhosds