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

Began extending "ssh keeps NAS awake"-functionality. ssh, ftp and smb work. Some refactorings to allow for more services. #22

Open
wants to merge 1 commit into
base: v2.x
Choose a base branch
from

Conversation

new-at-nas
Copy link

Hi fritz-hh,

your manageAcpi.sh script was 99% of what I'd been looking for. Thanks for the great work.

I added some functionality and would like to hear what you think about it.

The -s option (formerly "ssh keepawake" but I read s as "service") now works like this:

manageAcpi -s smb,300 -s ftp,60 

Each -s option takes a service and a duration argument. Right now, only ssh, ftp and smb work but more services can be added easily. Handling of other options is unchanged.

I would like to hear your opinion on the changes so far before investing more time.

Greetings,

Urs

PS: Some more ideas on how I would improve the script...:

  • Implement more services (ISCSI target, nfs, afp, rsync, unison etc.)
  • Improve documentation, especially by adding examples (saves time in the forum)
  • Does the usage of 1/0 for true/false conform to sh conventions? I think it's a little confusing.
  • I wrote a lot of twisted eval"" code to simulate arrays. Do you think the script could be ported to bash?
  • Some CL options trigger sleep, others prevent it. I'm not sure but that might be confusing to some users.

work. Some refactorings to allow for more services.
@fritz-hh
Copy link
Owner

fritz-hh commented Oct 20, 2023

Litterally 10 years later... Sorry for this!
Since I did quite many changes in the mean time (especially lately), there is no chance to merge your PR.
I think that your PR and comments are a good contribution though.
Generally I would prefer several small PR over a big PR (like this one)

Hi fritz-hh,

your manageAcpi.sh script was 99% of what I'd been looking for. Thanks for the great work.

@new-at-nas : Nice to see that the script help other NAS owner.

I added some functionality and would like to hear what you think about it.

The -s option (formerly "ssh keepawake" but I read s as "service") now works like this:

manageAcpi -s smb,300 -s ftp,60 

Each -s option takes a service and a duration argument. Right now, only ssh, ftp and smb work but more services can be added easily. Handling of other options is unchanged.

I would like to hear your opinion on the changes so far before investing more time.

Good idea, as long as the different services do not require different additional arguments
(I do not see why additional arguments would be needed though)
Do to short coming of the shell script language, this approach will require to use eval (as you already found out).
I am not completely against it though, but need to think about it...

PS: Some more ideas on how I would improve the script...:

  • Implement more services (ISCSI target, nfs, afp, rsync, unison etc.)

Currently I have no need for this (I only use SMB), but I would be open to the monitoring of more protocols if there is a strong need from the community.

  • Improve documentation, especially by adding examples (saves time in the forum)

Great idea. I would add your example to the script.

  • Does the usage of 1/0 for true/false conform to sh conventions? I think it's a little confusing.

return code 0 (i.e. function returns without an error) equal true in shell script, any other return code is considered false

  • I wrote a lot of twisted eval"" code to simulate arrays. Do you think the script could be ported to bash?

No idea concerning portability to bash.
I am not a big fan of "eval" in general.

  • Some CL options trigger sleep, others prevent it. I'm not sure but that might be confusing to some users.

I completely agree. -n should also prevent sleep (like -a, -s and -m). I already change the description of the option accordingly.
In addion the acpi state shall not be defined within -n, but shall be defined in a dedicated option.
I did not yet change this, since this would be a breaking change.

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

Successfully merging this pull request may close these issues.

2 participants