Open Synec5 opened 1 year ago
This has nothing to do with this project, but with the operating system you use. I will not completely answer you that questions, i will just give you hints where to look at.
You basically have three options:
Fully up to you which solution is the one best suited for you.
Ok this is not the best way in any way to fix this, but I did it like this:
import requests
import time
time.sleep(30)
# Perform login request and retrieve response cookie
response = requests.post(
'http://localhost:80/api/login',
json={'username': 'admin', 'password': '<<ENTER PASSWORD HERE>>'}
)
cookie = response.cookies.get('authentication')
print(response.text)
print("Cookie: " + str(cookie))
# Use response cookie to perform startup request
headers = {'Cookie': f'authentication={cookie}'}
data = {'bindip': '0.0.0.0', 'savefile': 'Load Latest', 'port': 34197}
response = requests.post(
'http://localhost:80/api/server/start',
headers=headers,
json=data
)
print(response.text)
I have this python script that logs in and starts the server.
And using crontab -e
i add a command that runs the script on reboot
@reboot python3 <<your path>/start_factorio.py
Hello, can someone tell me how I have to do that so that the "factorio-server-manager" starts automatically after a reboot (or the power on the PC).
Ubuntu Server
Manual start goes after I changed to the directory.
Best regards