From 45ede80ad6d23ad1ed0d8cfcf8ef006fc6778558 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Sun, 22 May 2022 18:37:59 +0200 Subject: [PATCH] add script that relaunches SteamVR and VRChat when VRChat crashes --- scripts/vrc-monitor.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 scripts/vrc-monitor.py diff --git a/scripts/vrc-monitor.py b/scripts/vrc-monitor.py new file mode 100755 index 0000000..6d1b52b --- /dev/null +++ b/scripts/vrc-monitor.py @@ -0,0 +1,33 @@ +#!/bin/env python3 +import time +import os + +def notify_fail(): + os.system('notify-send "Restarting SteamVR" "VRChat died again :(" --icon /home/crispypin/pictures/emotes/screech.gif') + +def notify_ok(): + os.system('notify-send "Go play VRChat" "It stayed open for 150s" --icon /home/crispypin/pictures/emotes/frogchamp.png') + +STATUSFILE = "/tmp/VRC_RUNNING" + +is_ok = True +for i in range(150): + time.sleep(1) + if not os.path.isfile(STATUSFILE): + is_ok = False + break + +if is_ok: + notify_ok() + exit() +else: + notify_fail() + +## restart steam +os.system("killall vrmonitor") +time.sleep(2) +# start steamvr +os.system("steam steam://rungameid/250820") +time.sleep(7) +# start vrchat +os.system("steam steam://rungameid/438100")