alinmear / docker-conanexiles

A docker container to easily provision and manage a conanexiles dedicated server using wine
MIT License
105 stars 74 forks source link

Shutdown notification is quite annoying... #35

Closed hardiselg closed 3 years ago

hardiselg commented 5 years ago

I find the rcon shutdown notification quite annoying because it does the notification in minute intervals. It would be nice if the time between notifications would be a bit longer, let's say 5min.

So actually I did exactly that. I modified the start_shutdown_timer function in the server controller file, where you can actually change the interval. In addition it will in all cases tell when 1 min is left for the update.

function start_shutdown_timer() {
    _t_val="$1"
    _interv=5
    _i=0
    _j=0

    while true; do
        if [ $_i == $_t_val ]; then
            break
        fi
        if [ $_j == $_i ] || [ $_i == $((_t_val-1)) ]; then
                notifier_debug "Shutdown Server in $((_t_val - _i)) minutes"

                if [[ ${CONANEXILES_Game_RconPlugin_RconEnabled} == 1 ]]; then
                        /usr/bin/rconcli broadcast --type shutdown --value $((_t_val - _i))
                fi
                if [ $_j == $_i ]; then
                        _j=$((_j+_interv))
                fi
        fi
        sleep 60
       _i=$((_i+1))
    done
}

Maybe it would be possible to push this edit also to master?

TitanSpirit commented 4 years ago

Can you provide the path to the script?

alinmear commented 4 years ago

I am looking into it. Maybe we should add a Flag to configure this?

hardiselg commented 4 years ago

@TitanSpirit the timer functions should be located here: https://github.com/alinmear/docker-conanexiles/blob/master/src/usr/bin/conanexiles_controller

@alinmear I think it is a good idea. By adding '_interval' to Docker environment variable this should work fine.

alinmear commented 3 years ago

I updated the function; notification will be send at 15,5,1 Minute