Launch a command without waiting the end

Ola @dev_team, I’m thinking loudly

I have one issue that I’m banging my head on a wall :slight_smile:

I want to launch some commands in nethgui that need a lot of time to execute and end it…of course during this time, nethgui is waiting the end and the user must wait before to use the server-manager…not acceptable :slight_smile:

I mean for example the clamscan command or the freshclam/ update.

I did that

but even if I change ‘signalEvent’ by ‘exec’ (and adjust sudo rights) the result is the same…nethgui is hanging up. No matter I do ‘&’ in my bash script because must wait between 60 to 600 seconds before to start, and clamscan must wait the end because it mails the result to the root.

One escape way could be to create a specific cron to start one minute after I launch the command, not nice but efficient :slight_smile:


I’d go with a systemd unit that can be started by the server-manager.

  1. create a script that executes systemctl calls
  2. configure it for sudo execution
  3. invoke the script from nethgui

I bet systemctl has everything you need for your requirements. In the future I’m evaluating to execute esmith events as systemd units. This could be a nice experiment :wink:

1 Like

Why not use ptrack as we already do for managing events from the Server Manager?

@stephdl here you can find some code we use in an internal project:

You can start a task with this code:

$st = new SystemTasks();
$task = $st->getTaskStatus($taskId);

and retrieve the status with this:

$st = new SystemTasks();
$task = $st->getTaskStatus($taskId);
1 Like

The purpose of ptrack is moving the progress bar during esmith events, which are designed to reconfigure the system. During “detached” events the UI is blocked to forbid running more events simultaneously.

Here we want to run a generic long task, for this reason I’d prefer looking at systemd units.

The unit exit status can be sent by email, written to a file and displayed by the server-manager, or sent to system journal and displayed with journalctl


Indeed I tested it quickly and it works with a type of service as ‘fork’…need more investigations on it.

1 Like