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

Support multi-user environments #49

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

gerases
Copy link

@gerases gerases commented Apr 29, 2018

When counting the number of running tmux processes, count only those
that belong to the current user.

tmux a shows as a separate process (must be the client process) and
thus needs to be excluded from the calculation as well. The previous
exclusion of tmux source was also incorporated.

When counting the number of running tmux processes, count only those
that belong to the current user.

`tmux a` shows as a separate process (must be the client process) and
thus needs to be excluded from the calculation as well. The previous
exclusion of `tmux source` was also incorporated.
# 2) `tmux a` (which shows an additional process)

ps -Ao "command pid uid" |\
grep $UID |\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose using ps -u $UID. grep $UID can match tmux process pid.


ps -Ao "command pid uid" |\
grep $UID |\
grep -E '^tmux' |\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add -E flag?

@gerases
Copy link
Author

gerases commented May 2, 2018 via email

@gerases
Copy link
Author

gerases commented Jun 22, 2018

Hi @bruno- , I took your advice and changed the code as you suggested.

@TheLocehiliosan
Copy link

Can this change be merged? It's critical in a multi-user environment.

@gerases gerases changed the title Refactor all_tmux_processes Support multi-user environments Jul 5, 2018
Sergei Gerasenko added 4 commits October 10, 2018 02:31
The pid the `grep -v` is trying to eliminate is not at the end
of the line.

`all_tmux_processes` produces the following output (for example):

```
tmux                        32069 29270
```

Here the first number is the pid and the second -- the uid. So, since
the idea of `number_tmux_processes_except_current_server` is to eliminate
32069 from consideration, it should look for "<SPACE>PID<SPACE>".
This is logical because we're increasing verbosity by setting the value
to 2. At 1, the debug is on but the user is not interrupted by the
status line messages.
@cgr71ii
Copy link

cgr71ii commented Oct 25, 2022

Hi! Why this PR was not accepted? Is not finished? It'd be very useful to solve #48 since I think it's a common use case to share resources among co-workers, where multiple tmux sessions might be alive for different users...

@bruno-
Copy link
Member

bruno- commented Oct 25, 2022

@cgr71ii this PR adds features that are outside the original scope. Also, some comments/questions were not addressed.
Since I personally don't need this feature I didn't want to push it.

If someone can make a clean, minimal change that addresses this problem I'll review the PR and merge if all is ok.

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

Successfully merging this pull request may close these issues.

4 participants