Skip to content

Instantly share code, notes, and snippets.

@rockerbacon
Created July 29, 2018 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rockerbacon/727acee1b19340c46756d0554b73dcce to your computer and use it in GitHub Desktop.
Save rockerbacon/727acee1b19340c46756d0554b73dcce to your computer and use it in GitHub Desktop.
Bash script for easily running Parsec's web app in Linux distros. Remember to edit the PARSEC_APP variable according to your browser
#!/bin/bash
#Command for running the web app
PARSEC_APP="google-chrome-stable ui.parsecgaming.com"
#PARSEC_APP="google-chrome --profile-directory=Default --app-id=heklcdmcmclhhhaholelehcafdpbemdn"
#If the daemon is already running, you can either restart the daemon or attempt to join the web app with the currently running daemon
#This variable determines if a join is to be attempted
ATTEMPT_JOIN_DAEMON=false
PARSEC_PID=$(pgrep -x parsecd)
JOINED_DAEMON=false
if [ "$PARSEC_PID" != "" ]; then
if [ "$ATTEMPT_JOIN_DAEMON" = true ]; then
JOINED_DAEMON=true
echo "The web app will attempt to join a currently running daemon. WARNING: a daemon can only be joined once"
else
echo "A daemon instance is already running"
echo "Would you like to kill the currently running daemon? All applications currently using it will stop working. (y/n)"
read KILL_PARSEC
if [ $KILL_PARSEC == "y" ]; then
echo "Killing daemon instance..."
kill $PARSEC_PID
else
echo "Execution aborted by the user"
exit
fi
fi
fi
if [ "$JOINED_DAEMON" = false ]; then
echo "Launching daemon..."
parsecd app_daemon=1 &
PARSEC_PID=$!
fi
echo "Launching web app..."
$PARSEC_APP
echo "Web app terminated"
echo "Terminating daemon..."
kill $PARSEC_PID
echo "Exited succesfully"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment