bugy / script-server

Web UI for your scripts with execution management
Other
1.59k stars 247 forks source link

Question: Disable stop of running script #749

Open xprntb3 opened 4 months ago

xprntb3 commented 4 months ago

Hello,

firstly, i deeply want to thank you for this amazing software and the work you guys are putting into it. This perfectly fits the use case i have and i have been looking for something like this for a long time.

I have a question about script execution, is it possible to prevent the user from doing that? I looked through the server config and script config documentation, and haven't found anything in this direction. The only thing i found:

https://github.com/bugy/script-server/wiki/Script-config#--shared_access

But this seems to only control which users/groups can generally run/stop/view this script, but not the actions they can do inside it. I want some scripts to manipulate data, and if, whyever a user would do that, i dont know, the user cancels the script, the data would be broken. Is there some way to deny this possibility to users? If not, is there maybe some workaround, like removing a line of code or removing the stop-button from the Web-UI?

Many thanks in advance.

bugy commented 4 months ago

Hi @xprntb3. Unfortunately there is no supported way to hide the button (or prohibit stop). You can hide the button via custom CSS. But it will be hidden for everyone.

xprntb3 commented 4 months ago

Hi @xprntb3. Unfortunately there is no supported way to hide the button (or prohibit stop). You can hide the button via custom CSS. But it will be hidden for everyone.

Hey, thanks for the quick reply! That's no problem, it can be hidden completely and for everyone. Is there a documentation on editing custom css? I haven't found one yet.

Once i got it working, i will write another comment in this issue explaining how, so that others that maybe need it aswell can apply it.

If you guys also take feature requests, maybe the ability to prevent stopping of scripts would be a good idea, i can imagine others might find this useful aswell

MNeill73 commented 4 months ago

Or, you could install a custom signal handler in the script, to intercept the signal from scriptserver.

For example, in Bash you'd use the "trap" command.

https://phoenixnap.com/kb/bash-trap-command

On Thu, May 23, 2024, 8:54 AM xprntb3 @.***> wrote:

Hi @xprntb3 https://github.com/xprntb3. Unfortunately there is no supported way to hide the button (or prohibit stop). You can hide the button via custom CSS. But it will be hidden for everyone.

Hey, thanks for the quick reply! That's no problem, it can be hidden completely and for everyone. Is there a documentation on editing custom css? I haven't found one yet.

Once i got it working, i will write another comment in this issue explaining how, so that others that maybe need it aswell can apply it.

If you guys also take feature requests, maybe the ability to prevent stopping of scripts would be a good idea, i can imagine others might find this useful aswell

— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/749#issuecomment-2127035742, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HBI3R74QEGW3LNMTDTKWDZDXRHVAVCNFSM6AAAAABIFBJYGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRXGAZTKNZUGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

bugy commented 4 months ago

@MNeill73 this won't work I think. Because STOP button will transform into KILL button after 5 seconds. And you cannot "trap" kill command.

MNeill73 commented 4 months ago

Eh, this is true...

In this case, then, you probably need to make use of backup copies, exit functions, and semaphore files to make sure you preserve intact data...

On Thu, May 23, 2024, 10:32 AM Yaroslav Shepilov @.***> wrote:

@MNeill73 https://github.com/MNeill73 this won't work I think. Because STOP button will transform into KILL button after 5 seconds. And you cannot "trap" kill command.

— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/749#issuecomment-2127279806, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HBI3T2MIO2UBAJ4OSV6LDZDX4XDAVCNFSM6AAAAABIFBJYGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRXGI3TSOBQGY . You are receiving this because you were mentioned.Message ID: @.***>

xprntb3 commented 4 months ago

Hello guys, found the solution!

first, go to your conf/theme/theme.css file (doesn't exist from the getgo, but you can download one of the custom themes for example)

Then edit the file and add the above css code to that file above the html:root definition:


.button-stop.btn.red.lighten-1 {
    display: none;
}

.button-stop.btn.disabled.red.lighten-1 {
    display: none;
}

html:root {
    --hover-color: rgba(255, 255, 255, 0.04);_
....

This will hide the stop-button.

Again, thanks to everyone!

bugy commented 4 months ago

Cool, yes, this is the right place to define your custom styles