updated service, python script and README for flatpak steam and solving shared memory being full
This commit is contained in:
parent
a55515b0b2
commit
6916ca5d1e
@ -15,6 +15,12 @@
|
|||||||
|
|
||||||
pip3 install pyvirtualdisplay pillow EasyProcess #needed for virtual display, create it inside a venv
|
pip3 install pyvirtualdisplay pillow EasyProcess #needed for virtual display, create it inside a venv
|
||||||
|
|
||||||
|
2023, instead of steam using flatpak steam
|
||||||
|
https://flatpak.org/setup/Debian
|
||||||
|
https://flathub.org/apps/details/com.valvesoftware.Steam
|
||||||
|
|
||||||
|
#NOTICE: steam might not be able to launch in case of the tmpfs /dev/shm filesystem being full. it seems safe to just delete u1001-Shm_* files and u1002-Shm_ files. It should be fine because the files exists as long as at least one process has them open. So until steam is killed i assume. You dont need to be root for killing them, the user running the bot has permissions to rm the files
|
||||||
|
|
||||||
#intel specific:
|
#intel specific:
|
||||||
|
|
||||||
apt-get remove xserver-xorg-video-intel
|
apt-get remove xserver-xorg-video-intel
|
||||||
@ -42,20 +48,20 @@
|
|||||||
## bashrc for x2go users
|
## bashrc for x2go users
|
||||||
in the users thats running a x2go session edit the .bashrc file and add the follwing (remember SDL_VIDEO_X11_VISUALID deppends on glxinfo from xterm terminal):
|
in the users thats running a x2go session edit the .bashrc file and add the follwing (remember SDL_VIDEO_X11_VISUALID deppends on glxinfo from xterm terminal):
|
||||||
|
|
||||||
|
if [[ $DISPLAY ]]; then
|
||||||
|
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
||||||
|
export SDL_VIDEO_X11_VISUALID=0x205
|
||||||
|
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
||||||
|
#use this one to launch steam minimized once
|
||||||
|
#flatpak run com.valvesoftware.Steam -no-browser +open steam://open/minigameslist
|
||||||
|
/home/$USER/.var/app/com.valvesoftware.Steam/data/Steam/steam.sh -applaunch 240 -textmode -novid -nosound -noipx -nojoy -noshaderapi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $DISPLAY ]]; then
|
|
||||||
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
|
||||||
export SDL_VIDEO_X11_VISUALID=0x205
|
|
||||||
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
|
||||||
steam -no-browser +open steam://open/minigameslist
|
|
||||||
fi
|
|
||||||
|
|
||||||
#-no-browser +open steam://open/minigameslist reduces cpu being used by steam
|
#-no-browser +open steam://open/minigameslist reduces cpu being used by steam
|
||||||
|
|
||||||
##steam settings -> library -> low bandwith mode and low performance mode
|
##steam settings -> library -> low bandwith mode and low performance mode
|
||||||
|
|
||||||
#2023, try steam beta mode in steam settings to prevent Bus error (core dumped) "$STEAMROOT/$STEAMEXEPATH" "$@"
|
|
||||||
|
|
||||||
#X2GO_NXAGENT_DEFAULT_OPTIONS="-options nx/nx,sleep=0" /etc/x2go/x2goagent.options
|
#X2GO_NXAGENT_DEFAULT_OPTIONS="-options nx/nx,sleep=0" /etc/x2go/x2goagent.options
|
||||||
|
|
||||||
#keeps session as R instead of S which is needed for interaction with graphical components such as steam and CS:S
|
#keeps session as R instead of S which is needed for interaction with graphical components such as steam and CS:S
|
||||||
@ -74,5 +80,3 @@
|
|||||||
#check if all libs are present with
|
#check if all libs are present with
|
||||||
cd ~/.steam/steam/ubuntu12_32
|
cd ~/.steam/steam/ubuntu12_32
|
||||||
LD_LIBRARY_PATH=. ldd vgui2_s.so
|
LD_LIBRARY_PATH=. ldd vgui2_s.so
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ After=network.target
|
|||||||
User=autismbot%i
|
User=autismbot%i
|
||||||
Group=autismbot%i
|
Group=autismbot%i
|
||||||
WorkingDirectory=/home/autismbot%i/ze_runner
|
WorkingDirectory=/home/autismbot%i/ze_runner
|
||||||
|
Environment=PYTHONUNBUFFERED=1
|
||||||
Environment=PATH=/home/autismbot%i/ze_runner/venv/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
|
Environment=PATH=/home/autismbot%i/ze_runner/venv/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
|
||||||
ExecStart=/home/autismbot%i/ze_runner/ingamefollowct.py
|
ExecStart=/home/autismbot%i/ze_runner/ingamefollowct.py
|
||||||
Restart=always
|
Restart=always
|
||||||
|
@ -16,7 +16,7 @@ import time
|
|||||||
whoami = subprocess.getoutput(["whoami"])
|
whoami = subprocess.getoutput(["whoami"])
|
||||||
with open(f'/home/{whoami}/ze_runner/config.json') as jsonfile:
|
with open(f'/home/{whoami}/ze_runner/config.json') as jsonfile:
|
||||||
data_ports = json.load(jsonfile)
|
data_ports = json.load(jsonfile)
|
||||||
looptestPath = f"/home/{whoami}/.steam/debian-installation/steamapps/common/Counter-Strike Source/cstrike/cfg/looptest.cfg"
|
looptestPath = f"/home/{whoami}/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/Counter-Strike Source/cstrike/cfg/looptest.cfg"
|
||||||
chatmsg = ""
|
chatmsg = ""
|
||||||
|
|
||||||
def writeCfgInput(Input_user):
|
def writeCfgInput(Input_user):
|
||||||
@ -120,18 +120,9 @@ def restart_sdl_and_steam():
|
|||||||
print(f'xterm_cmd: {xterm_cmd}')
|
print(f'xterm_cmd: {xterm_cmd}')
|
||||||
subprocess.getoutput([xterm_cmd])
|
subprocess.getoutput([xterm_cmd])
|
||||||
print('reached .bashrc executing steam and variables')
|
print('reached .bashrc executing steam and variables')
|
||||||
time.sleep(60)
|
time.sleep(90)
|
||||||
#we sleep here to wait for .bashrc to launch steam. It takes some time
|
#we sleep here to wait for .bashrc to launch steam. It takes some time
|
||||||
|
|
||||||
def launch_css_process():
|
|
||||||
print('preparing to launch game....')
|
|
||||||
#deleting maps
|
|
||||||
subprocess.getoutput([f"rm '/home/{whoami}/.steam/debian-installation/steamapps/common/Counter-Strike Source/cstrike/download/maps/'*"])
|
|
||||||
|
|
||||||
#launching game
|
|
||||||
subprocess.getoutput([f"/home/{whoami}/.steam/debian-installation/steam.sh -applaunch 240 -textmode -novid -nosound -noipx -nojoy -noshaderapi -port {data_ports['steam_port']}"])
|
|
||||||
print('finished starting game')
|
|
||||||
|
|
||||||
def bot_connect(data):
|
def bot_connect(data):
|
||||||
#use whatever ip you want here to connect with
|
#use whatever ip you want here to connect with
|
||||||
str1 = ""
|
str1 = ""
|
||||||
@ -150,13 +141,17 @@ if __name__ == '__main__':
|
|||||||
external_port_messages = data_ports['chat_external_port']
|
external_port_messages = data_ports['chat_external_port']
|
||||||
buffer_size = 4096 #potentially not large enough?
|
buffer_size = 4096 #potentially not large enough?
|
||||||
connection_issue_counter = 0;
|
connection_issue_counter = 0;
|
||||||
pid = return_user_owned_pid("pidof hl2_linux")
|
#deleting maps
|
||||||
if not pid:
|
subprocess.getoutput([f"rm '/home/{whoami}/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/Counter-Strike Source/cstrike/download/maps/'*"])
|
||||||
restart_sdl_and_steam()
|
#deleting POSIX shared memory objects, as long as one process has them open they exist. so probably until steam gets turned off. THis is to prevent /dev/shm from being full
|
||||||
else:
|
subprocess.getoutput([f"rm /dev/shm/u1001-Shm_*"])
|
||||||
kill_owned_process("pidof hl2_linux")
|
subprocess.getoutput([f"rm /dev/shm/u1002-Shm_*"])
|
||||||
|
|
||||||
|
|
||||||
|
restart_sdl_and_steam()
|
||||||
is_bot_connected_to_ze2 = False
|
is_bot_connected_to_ze2 = False
|
||||||
launch_css_process()
|
|
||||||
|
print('preparing to launch game....')
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
sock.bind(("", local_port))
|
sock.bind(("", local_port))
|
||||||
@ -227,21 +222,3 @@ if __name__ == '__main__':
|
|||||||
writeCfgInput(strInput)
|
writeCfgInput(strInput)
|
||||||
finally:
|
finally:
|
||||||
sock.close()
|
sock.close()
|
||||||
|
|
||||||
#/home/gameservers/.steam/debian-installation/steamapps/common/Counter-Strike Source/cstrike/cfg/autoexec.cfg:
|
|
||||||
#alias loop "exec looptest.cfg; wait 5; loop;"; wait 5; loop;
|
|
||||||
#create looptest.cfg in /cfg/ folder
|
|
||||||
#X2GO_NXAGENT_DEFAULT_OPTIONS="-options nx/nx,sleep=0" /etc/x2go/x2goagent.options
|
|
||||||
#keeps session as R instead of S which is needed for interaction with graphical components such as steam and CS:S
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
.bashrc requires:
|
|
||||||
if [[ $DISPLAY ]]; then
|
|
||||||
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
|
||||||
export SDL_VIDEO_X11_VISUALID=0x205
|
|
||||||
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
|
||||||
steam -no-browser
|
|
||||||
fi
|
|
||||||
"""
|
|
||||||
#screen -d -m -S ze_runner python3 ingamefollowct.py
|
|
||||||
|
Loading…
Reference in New Issue
Block a user