Best way to allow an end user to trigger a script?

Status
Not open for further replies.

toolforger

Explorer
Joined
Aug 8, 2017
Messages
60
Hi all,

assuming that:
- I have an end user that does not have administrative access, and
- the Freenas box has a script that the end user should be able to trigger,
what is the easiest way to allow this?

A mechanism that allows some kind of rate limiting is preferred but not really necessary.
The script is parameterless. All the user can do is trigger it and wait for the "operation completed" mail.
 

toolforger

Explorer
Joined
Aug 8, 2017
Messages
60
I could even make the script the user's login shell.
I've been thinking about providing a web page with links that trigger the scripts. People wouldn't have to install an SSH client then (not everybody has one, or is comfortable with SSH). I have no idea how to do that though.

Are there better options?
 
Last edited:

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Lots of ways to skin this cat, really; the trade-off is going to be work for you vs. work for the user. Just in the realm of SSH, depending on the user's environment (*nix, Mac, or Windows?) there are going to be dozens of variations (*nix and Mac would make it very simple indeed). You could use a web SSH client installed in a jail--that way there would be nothing to install on their computer. You could build a web page that will launch the script, I suppose in some CGI fashion. You could spend $5 on an Amazon Dash button and set up Dasher in a jail.
 

toolforger

Explorer
Joined
Aug 8, 2017
Messages
60
Yeah, CGI was the other option. How do I add this to Freenas I'm wondering?

It is a two-step task: Run an rsync action, then run a snapshot action.
The actions already exist, "all I need to do" is to create a button that users can press to start it...
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504

toolforger

Explorer
Joined
Aug 8, 2017
Messages
60
Hm. I know only Apache. What's the easiest webserver to set up if all it does is display a single page with a single button?
Plus, how do I give it a .local DNS name?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Any way for a non-Prime member to get the $5 buttons?
Sign up for a 30-day free trial of Prime? Don't know, otherwise--I've been a Prime member long enough that I didn't realize most of them were limited to Prime members.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
What's the easiest webserver to set up if all it does is display a single page with a single button?
That's really getting outside of my knowledge base, but Caddy seems to have pretty simple configuration. For a .local name, I think you'd need to look at mDNS/Avahi.
 

toolforger

Explorer
Joined
Aug 8, 2017
Messages
60
Mmm... Caddy is just sort-of open source, and when it came to plugins I had an instant flashback to MEGO.
Googling for "simple webserver" took me to http servers in various scripting languages, so maybe that's what I'd like.

What's still unclear to me is how to give the jailed webserver an IP address.
The advanced jail configuration option point in roughly the right direction, but the specifics are frustratingly vague. I guess I'll have to RTM again, and hope I get all the needed information.

What I'd really like to do is to just have https://freenas.local/username set up as a web page with a big button saying "Back my data NOW".
Jails and permanently running webservers (or fcgi) are just overengineered for that.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Status
Not open for further replies.
Top