Razzmatazzz / ValheimServerWarden

Manage one or more Valheim dedicated server instances.
GNU General Public License v3.0
38 stars 4 forks source link

Add possibility to set time for first server restart #45

Open jensbrak opened 2 years ago

jensbrak commented 2 years ago

As for now, the application has option for doing server restarts at X hours interval. However, the restart timer counts from application start which might be... inconvenient, at least if restart interval is more than the suggested default of 4 hours.

Example: I want the server to be restarted at 03:00 each night (in other words, at a 24h interval). With current implementation I see only one way to do that: make sure the application is started at 03:00. Either manually or by some sort of automation. (Or am I missing something?)

Suggestion for new feature: in Server Details, tab settings, add possibility to define server restart start time (to make it easy and coherent with existing functionality I suggest a textbox, or even better a dropdown with all hours from 1 to 24). This option would be enabled/disabled with the same kind of logic that the option for restart hours / interval currently is.

I'd imagine one would want one extra option in the proposed drop down, at the top, to use app start time instead. This would be the default and would make the new feature fully backwards compatible. This default option will, in other words, make the application behave as it do today. Any other selected value (1-24) in combination with enabling the server restart option, will result in server restarts being done from the given hour (and then at the given interval as before).

Example: With my example above, I would enable the server restart timer, enter 24 as interval and select 03 in the new drop down. After saving, the restart timer will be fired first time when 03:00 passes and then fire at my 24 hour interval.


If this is not a completely sh**y idea, I'd be happy to provide a PR with said functionality. In fact, more or less coded it already. :)


PS. Thanks for a great piece of software, well done! I have more ideas and possibly PR's if interested... DS

Razzmatazzz commented 2 years ago

Having scheduled restarts is definitely useful for everyone on a server, and I always welcome PRs that add useful features! :)

jensbrak commented 2 years ago

Very well then, I'll clean up and test my code ASAP then. :)

BTW: Do you prefer adding issues for these feature proposals or should I just do the PR's directly whenever they're done?

Razzmatazzz commented 2 years ago

Sorry for the delayed response. If the PR describes the new feature and the rationale for it, no need to open an issue. If I've got questions about it, we can message back and forth a bit in the PR itself.

ETA: of course, if you want to float an idea before putting in the work to implement it, go ahead and open an issue and we can discuss first!