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

fix helper #135

Closed
wants to merge 3 commits into from
Closed

fix helper #135

wants to merge 3 commits into from

Conversation

hakavlad
Copy link
Contributor

No description provided.

Copy link

@codelingo codelingo bot left a comment

Choose a reason for hiding this comment

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

LGTM

@hakavlad
Copy link
Contributor Author

  • fix: exclude root
  • this script just works now
  • todo: fix makefile to install this script in /usr
  • todo: update readme: how to use this script

@hakavlad
Copy link
Contributor Author

Do you have any questions?

@rfjakob
Copy link
Owner

rfjakob commented Jun 22, 2019

Yes, why is there no help text anymore for the script itself, and why does it require 5 arguments now instead of 2?

@hakavlad
Copy link
Contributor Author

why does it require 5 arguments now instead of 2

mem avail:     0 of  3859 MiB ( 0 %), swap free: 1233 of 7718 MiB (15 %)
mem avail:     0 of  3859 MiB ( 0 %), swap free:  846 of 7718 MiB (10 %)
low memory! at or below SIGTERM limits: mem 10 %, swap 10 %
sending SIGTERM to process 30747 "tail": badness 586, VmRSS 2128 MiB
process exited after 0.5 seconds
['./helper', '-i', 'dialog-warning', 'earlyoom', 'Low memory! Killing process 30747 tail']
mem avail:  2118 of  3859 MiB (54 %), swap free: 5504 of 7718 MiB (71 %)
mem avail:  2077 of  3859 MiB (53 %), swap free: 5512 of 7718 MiB (71 %)

The old script with two arguments did not work at all.
New script works: https://imgur.com/a/p7ucI5k

@hakavlad
Copy link
Contributor Author

why is there no help text anymore for the script itself

It can be fixed later if you want.

@hakavlad
Copy link
Contributor Author

@rfjakob What's up?

Copy link

@codelingo codelingo bot left a comment

Choose a reason for hiding this comment

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

LGTM

@hakavlad
Copy link
Contributor Author

hakavlad commented Jul 3, 2019

@rfjakob could you merge this PR?

Copy link
Owner

@rfjakob rfjakob left a comment

Choose a reason for hiding this comment

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

Requiring 5 arguments is unneccessary, and the script needs to have a help text.
The old script works fine with 2 arguments on Fedora.

@hakavlad
Copy link
Contributor Author

hakavlad commented Jul 4, 2019

Requiring 5 arguments is unneccessary

On the contrary, the helper accepts exactly five arguments in argv:

[
    'notify_all_users.py',                    # argv[0]
    '-i',                                     # argv[1]
    'dialog-warning',                         # argv[2]
    'earlyoom',                               # argv[3]
    'Low memory! Killing process 30747 tail'  # argv[4]
]

This is how it works if you use this script via earlyoom -N notify_all_users.py to notify all users.

@hakavlad
Copy link
Contributor Author

hakavlad commented Jul 4, 2019

The old script works fine with 2 arguments on Fedora.

How do you use old script? How do you connect it to earlyoom?

@hakavlad
Copy link
Contributor Author

hakavlad commented Jul 5, 2019

The old script works fine with 2 arguments on Fedora.

OK, but earlyoom uses more then 2 arguments.

$ sudo ./notify_all_users.py
Usage:
  ./notify_all_users.py [notify-send options] summary [body text]
Examples:
  ./notify_all_users.py mytitle mytext
  ./notify_all_users.py -i dialog-warning earlyoom "killing process X"

OK

$ sudo ./notify_all_users.py mytitle mytext

OK, it silently shows a notification.

$ sudo ./notify_all_users.py -i dialog-warning earlyoom "killing process X"
No summary specified. 

No notification was shown. Is it OK?

The old script is completely incompatible with earlyoom.

@hakavlad
Copy link
Contributor Author

hakavlad commented Jul 5, 2019

You broke the original script (https://github.com/hakavlad/notify-send-root-wrapper). Original script and new script just work. Your version of the script does not work as intended.

Copy link

@codelingo codelingo bot left a comment

Choose a reason for hiding this comment

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

LGTM

@hakavlad
Copy link
Contributor Author

hakavlad commented Jul 5, 2019

script needs to have a help text

Done. And it works with any len(argv).

rfjakob pushed a commit that referenced this pull request Jul 6, 2019
@rfjakob
Copy link
Owner

rfjakob commented Jul 6, 2019

Merged as 23bb71a , thanks

@rfjakob rfjakob closed this Jul 6, 2019
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.

None yet

2 participants