Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get PID of process inside a SSH Connection #69

Open
xKushGene opened this issue Oct 17, 2018 · 0 comments
Open

Get PID of process inside a SSH Connection #69

xKushGene opened this issue Oct 17, 2018 · 0 comments

Comments

@xKushGene
Copy link

While following code on the following command will work:

Normal use (exec):
sh file.sh

file.sh:
nohup dotnet file.dll > output.log 2>&1 & echo $! > save_pid.txt

The same code within a SSH::run(..) will semi-work:
\SSH::run([ 'cd www/laravel/storage/app/files/' . \Auth::user()->id . '/' . $fileID, 'nohup dotnet ' . $file->filename . ' > output.log 2>&1 & echo $! > save_pid.txt', ]);

Here the output.log will be created fine with the output. But the save_pid.txt with the pid of the created process will not be created.

So my first idea was to catch the pid of the created SSH Connection.
And if i want to close the process later i just kill the process of the SSH Connection.

But i couldn't found a function to catch the pid from the SSH Connection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant