script-server icon indicating copy to clipboard operation
script-server copied to clipboard

Question: Disable stop of running script

Open xprntb3 opened this issue 1 year ago • 7 comments

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.

xprntb3 avatar May 23 '24 07:05 xprntb3

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.

bugy avatar May 23 '24 07:05 bugy

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

xprntb3 avatar May 23 '24 12:05 xprntb3

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: @.***>

MNeill73 avatar May 23 '24 13:05 MNeill73

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

bugy avatar May 23 '24 14:05 bugy

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...

  • Backup the data set
  • Start the processing loop ** "touch /tmp/myscript.started" ** Process your file ** Remove the touch file ** Remove the backup data set
  • End script
  • Exit function ** If you're exiting, and the touch file still exists... *** rm the touch file *** rm the live data set *** Move the backup data set back to the live data set ** end exit

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: @.***>

MNeill73 avatar May 23 '24 14:05 MNeill73

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!

xprntb3 avatar May 23 '24 14:05 xprntb3

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

bugy avatar May 23 '24 15:05 bugy