Script to powerdown server on 2 invalid login attempt


Recommended Posts

Hello.

 

I would like to run a script in user scripts to power down the server after 2 invalid login attempt.

 

I've been searching the forum but haven't found anything similar.

 

The server could be doing some tasks so if a graceful shutdown is an option that would be preferred.

 

Would something like that be able to achieve? I'm on 6.10.3 if that matters.

 

Thank you.

 

 

 

Link to comment
5 minutes ago, trurl said:

Have you tried scheduling shutdown from the script with at command?

No i haven't. I don't want it to be on a schedule - i want the server to power down when there is a second invalid login attempt.

 

So maybe a script isn't what i need.

 

Is there any way to achieve this?

Link to comment

I didn't suggest you put it "on a schedule". google linux 'at' command.

 

The reason I suggested it is because I thought perhaps if you tried to run a script that directly executed shutdown, the shutdown wouldn't complete until the script completed, and the script couldn't complete until the shutdown command completed, so hung.

 

If you 'at' the shutdown command to run very soon, then the script could exit after the 'at' command completed, then the 'at' would execute shutdown.

 

Link to comment
On 8/8/2022 at 5:33 PM, trurl said:

I didn't suggest you put it "on a schedule". google linux 'at' command.

 

The reason I suggested it is because I thought perhaps if you tried to run a script that directly executed shutdown, the shutdown wouldn't complete until the script completed, and the script couldn't complete until the shutdown command completed, so hung.

 

If you 'at' the shutdown command to run very soon, then the script could exit after the 'at' command completed, then the 'at' would execute shutdown.

 

Oh I understand now. Sounds like a good idea. I will try using the at command.

 

Thank you for your input.

Link to comment
On 8/8/2022 at 5:42 PM, kizer said:

You could tinker with this some. Obviously you want to change the script so it doesn't wipe out your machine, but instead tell it to watch your logs and preform a shutdown instead. 

 

 

https://www.reddit.com/r/unRAID/comments/vrinun/dead_mans_switch/?utm_source=BD&utm_medium=Search&utm_name=Bing&utm_content=PSR1

 

I've read the post and looked at the script. It looks promising.

 

I will have to learn some scripting to modify it.

 

Thank you for your input.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.