[RELEASE] Multiplatform Auto Restarter/Server Manager v1.0

Like I said, this is a script to reboot the server at the given times. Install a resource to prompt the players in game and configure this resource to display the same reboot times you set on my script.

This is what I have for config_path

config_path = r'M:/ServerManager/config.json'

And in the config itself, are you using “\” somewhere?
The error also says line 32. Check this line on the config.

Found it…

  "backup": {
    "backup":true,
    "files":["resources", "server.cfg"],
    "location":"\\SRGTAVRP\Backup",
    "date":["MM","DD","YYYY"],
    "prefix":"Backup - "

Does Server Manager support backing up to another server? Or will I need to back it up locally and create a script to move it?

I fixed the config file…it runs now. However, I am getting this error (Not sure where to look to fix it):

C:\Windows\system32>M:\ServerManager\manager.py
[CONFIG.JSON CRITICAL ERROR] - The path for the en language file does not exist.

The config.json could not be loaded.
Press enter to exit…

My folder structure is as follows (If it helps):

    Directory: M:\ServerManager


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        5/18/2019  11:08 AM                languages
-a----        5/19/2019  10:32 AM           1300 config.json
-a----         5/6/2019  10:43 PM           1013 engine.bat
-a----        5/19/2019   9:06 AM          25201 manager.py
-a----        5/18/2019   2:03 AM          90285 README.html
-a----        5/18/2019   3:18 AM           9230 README.md
-a----        5/18/2019   2:51 AM            228 Start_Server.cmd

Inside “languages”:

    Directory: M:\ServerManager\languages


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         5/9/2019   9:51 PM           1966 english.json
-a----        5/18/2019  12:07 AM           2100 portuguese.json

Try using the absolute path (C:/…) instead of just languages/…

No, only to local. The backup function copies the files to that path using cmd commands. If you can transfer to other server using cmd commands, then you can do it, but you would have to do some modification on the code.

I put the absolute path in, and it could find the languages now. However, it’s throwing this error:

w = windll.kernel32
sl = windows_locale[w.GetUserDefaultUILanguage()]
  if sl[:2].lower() != config['lang']['system'].lower():
     print("[CONFIG.JSON CRITICAL ERROR] - Check if your system language is correct.")
     return False

I don’t know enough of your coding to fix the on-going issues.

Would it be easier to just message you about fixing this?

Oh, this is because I forgot to say to everybody to install the python windows module.

  1. Open CMD
  2. Type pip install ctypes
    2.1) If it does not work, try py pip... or python pip...

You also will need to do that with psutil.

I think those 3 are the only modules that need to be installed, all the others come with python. However, here are the list for all modules used, feel free to try pip install... on all of them to make sure everything is installed.

  • subprocess
  • win32gui
  • win32process
  • win32api
  • win32con
  • signal
  • psutil
  • locale
  • ctypes

About the errors, so far no error acctually happened, only problems on the config file and lack of a certain module. When you get everything set up, it is supposed to run just fine. The tests I did on my computer went well.

If you get an error while installing an module, it’s probably a built-in library, so there is no need to install yet. Long story short: just ignore.

Maybe a misunderstood your question. Next next time please send here the error message, not the code for it. You had a problem running this piece of code or you received this message?

If you received the message, check the config under language>system to see what is your language there, it has to be the same of your computer.

Anyway, this does not affect anything now, just delete return False.

But, if the error was running this piece of code, do what I said before about pip install.

Thanks for the Python advice, I will start working on that…

As for the code snippet I posted, I used that instead of copying the error from cmd, was looking to see if I could find anything related to that to fix it without having to keep bothering you about this issue.

I got it to work i guess but after 1 min ill get this… it seems im missing a python module but cant find it anywhere;

[MANAGER STARTED] - 05/20/19 09h13m
[05/20/19 - 09h13m] Server started

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\servermanager\manager.py", line 625, in <module>
    server.start() #TODO: Create FiveM server and do some testing
  File "C:\Users\Administrator\Desktop\servermanager\manager.py", line 507, in start
    set_priority(self.pid, config['server']['priority'])
  File "C:\Users\Administrator\Desktop\servermanager\manager.py", line 380, in set_priority
    handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
pywintypes.error: (87, 'OpenProcess', 'The parameter is incorrect.')

In one of the answers above I explained how you can fix missing modules errors.

pip install [module] on CMD. In this case I belive it’s ctypes

getting error psutil not found tried to install and get an error

C:>py pip install ctypes
C:\Users\Administrator\AppData\Local\Programs\Python\Python37\python.exe: can’t open file ‘pip’: [Errno 2] No such file or directory

Found the fix use ```
py -m pip install

same issue, have you fixed it by chance?? ive tried everything

Traceback (most recent call last):
File “C:\NEWESX\manager.py”, line 625, in
server.start() #TODO: Create FiveM server and do some testing
File “C:\NEWESX\manager.py”, line 507, in start
set_priority(self.pid, config[‘server’][‘priority’])
File “C:\NEWESX\manager.py”, line 380, in set_priority
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
pywintypes.error: (87, ‘OpenProcess’, ‘The parameter is incorrect.’)

Go on manager.py and comment out/delete line 507.

This is a known issue, I will let you know when it’s fixed.

1 Like

that was it ty

Helpme pls error

I can not fix this error in any way

Edit:
when I try to run by cmderror2

Hi guys have this problem ‘Start_Server.cmd’ is not recognized as an internal or external command,
operable program or batch file. any ideas? no error in CMD anymore