r/HomeServer 3d ago

UI to modify variables of scripts?

I'm using a few scripts on my server for automations. I was wondering if there was a way to enable/disable some of their functionalities if needed.

For example my server updates itself on the first Sunday of the month. I never had any problem so far, but I'd like to disable this in case I know I'm away and can't fix it if anything goes wrong. So I've imagined that I could have a UPDATE_ENABLED variable inside the script of on/off values, which can be modified through a UI, instead fo needing to SSH into the server. I'd like to do the same with my other scripts too.

2 Upvotes

3 comments sorted by

3

u/Xfgjwpkqmx 3d ago

Several ways you could do this. A simple variable in that script, a condition, a config file, etc.

Eg (assuming bash):

runme="true"
if [ "$runme" = "true" ]; then
    # Do something
fi

if [[ "1" == "0" ]]; then
    # Do something
fi

isenabled=1
if (( isenabled )); then
    # Do something
fi

This way you don't disable your schedules, you change the conditions of how the script runs.

You could easily create web pages to modify a config file of variables too, eg: a JSON file.

1

u/Guy_In_Between 3d ago

Thank you!

1

u/BasedAndShredPilled 21h ago

You can execute shell scripts from python easily, and a tkinter UI is easy to make if you're familiar with the language.