This one is used to zip a folder date and time it then drop into dropbox. just automate the process for easy back ups.

Back ups code:
@echo off

set "processName=YourProcess.exe"
set "processPath=C:\Path\To\YourProcess.exe"
set "restartDelay=30"

:StartProcess
start "" "%processPath%"

:CheckProcess
tasklist /FI "IMAGENAME eq %processName%" | find /I "%processName%" >nul
if errorlevel 1 (
    echo Process "%processName%" is not running.
    timeout /t %restartDelay% >nul
    tasklist /FI "IMAGENAME eq %processName%" | find /I "%processName%" >nul
    if errorlevel 1 (
        echo Restarting process "%processName%"...
        goto StartProcess
    )
)

timeout /t 5 >nul
goto CheckProcess

This is a bat to monitor servuo,exe in the event that it crashes... If it crashed for longer than 30 seconds it will reboot it. This should work fine through restarts.

servuo.exe monitor:
@echo off

set "processName=YourProcess.exe"
set "processPath=C:\Path\To\YourProcess.exe"
set "restartDelay=30"

:StartProcess
start "" "%processPath%"

:CheckProcess
tasklist /FI "IMAGENAME eq %processName%" | find /I "%processName%" >nul
if errorlevel 1 (
    echo Process "%processName%" is not running.
    timeout /t %restartDelay% >nul
    tasklist /FI "IMAGENAME eq %processName%" | find /I "%processName%" >nul
    if errorlevel 1 (
        echo Restarting process "%processName%"...
        goto StartProcess
    )
)

timeout /t 5 >nul
goto CheckProcess

Essentials to me as I'm not going to do this manually because id rather be doing something else.
 
looks cool, but if you're in the process of zipping a save file when it tries to save the world then the save process will stop and it won't be able to save again until you restart the server

effectively leaving your with hours/days/more of lost play that can't be saved

this process might work better but I haven't tested it. you would put this code after the part where a backup folder is created


C#:
string sourceFilePath = @"C:\path\to\your\file.txt"; // Path to the file to be zipped
        string destinationFolderPath = @"C:\path\to\destination\folder"; // Destination folder for the zipped file

        // Check if the source file exists
        if (!File.Exists(sourceFilePath))
        {
            Console.WriteLine("Source file does not exist.");
            return;
        }

        // Create a zip archive file
        string zipFilePath = Path.Combine(destinationFolderPath, "zippedFile.zip");

        try
        {
            ZipFile.CreateFromDirectory(Path.GetDirectoryName(sourceFilePath), zipFilePath);
            Console.WriteLine("File zipped successfully.");

            // Move the zipped file to the destination folder
            try
            {
                File.Move(zipFilePath, Path.Combine(destinationFolderPath, Path.GetFileName(zipFilePath)));
                Console.WriteLine("File moved successfully.");
            }
            catch (IOException e)
            {
                Console.WriteLine($"An error occurred while moving the zipped file: {e.Message}");
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine($"An error occurred while zipping the file: {ex.Message}");
        }
 
Back