Kirby 3 Terminal

Manage background processes from the panel. Define scripts like you might already be familiar with from npm . Start or stop predefined scripts and monitor the output directly in the panel.

3 Likes

This.

I can think of so many uses for this one. Good work @lukaskleinschmidt

1 Like

Hi @lukaskleinschmidt,

is this plugin working on localhost? I get the error “sh: setsid: command not found” when running via localhost on Mac. Should i test it on a deployed page?

Kind regards Tobi

According to stack overflow, it won’t work on macos: https://stackoverflow.com/questions/36590905/is-setsid-command-missing-on-os-x

Only windows and linux… But I don’t have a mac, can’t try.

Okay @rasteiner,

saw the same topic and was assuming that too, just wanted to check if there are workarounds.

But yeah, that means on Prod it should work well, right?

Greets Tobi

I’m no expert, someone in that topic mentions FreeBSD (on which macos was based) being the problem and some hosting providers use FreeBSD. If possible I would do a quick check in the production environment

Hi @rasteiner, did a quick check on my server and there is the same Problem. Anyone else had this problem before?

Edit: On the Prod of the Client on Host-Europe it is working. But only when i refresh the Page… Otherwise i get API-Errors in the Console. Strange Behaviour…

Hi @ToGe88, what does your script your are trying to run look like?
And could you please post the exact error you are getting from the API?

Hi @lukaskleinschmidt, thanks for your quick answer. These are the same scripts as in your Readme, i didn’t edit them so far. On localhost (propably the Mac Problem) and on Strato Host i get this error:

On Host Europe it is working but with this errors in the console:

Hope this helps.

Could you please post the response of one of these requests from the network tab of your dev tools?

Strato may not allow the shell_exec function to run. You can try to run this code snippet somewhere on the server to make sure shell_exec is available.

<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
?>

shell_exec was outputting the root files as expected, it was okay. But the Panel Terminal tries to reload the request again and again and fails. But it has no errors in the console.

Could you modify the plugins index.php#L165 like this and try if it works:

return Response::json($body, null, null, [
    'Content-Length' => $size,
]);

And please let me know what Kirby version you are using.

Hi @lukaskleinschmidt, this helped solving the problem on the Host Europe Server, still no chance on the Strato Server. Maybe it really isn’t able to work with the setsid…

I will release a patch for this probably today. Just have to figure out which kirby version broke the current implementation.

Regarding the setsid. This one is actually only required under certain circumstances. I added it because it was the only way I figured out to be able kill any potentially spawned child processes reliably. I will have another look. Perhaps I can find another way some years later :slight_smile:

Thanks for your help. Btw. i’m using 3.3.1.

You should really keep your installations up to date. Only yesterday we published a security patch!

You’re right. The Repo is from the beginning of this year and now i’m adding a Release-Circle for Publishing, which i need the Terminal for. Updated to latest version now.

I just published a new release. I was also able to get rid of using setsid.

Please let me know if everything is working as expected.

Hey @lukaskleinschmidt, thanks for your quick work. It is now working on localhost too :slight_smile:

1 Like