Skip to content

Instantly share code, notes, and snippets.

@allquixotic
Created January 4, 2014 05:22
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 allquixotic/8252054 to your computer and use it in GitHub Desktop.
Save allquixotic/8252054 to your computer and use it in GitHub Desktop.
Administration scripts for [SO-ChatBot](https://github.com/allquixotic/so-chatbot) using [so-chatbot-driver](https://github.com/allquixotic/so-chatbot-driver) -- both Firefox and PhantomJS versions of the admin scripts depending on what you want to do.
#Rebuilds the SO-ChatBot from git master, then restarts the bot -- FIREFOX VERSION.
cd SO-ChatBot; git pull; cd ..; ./reloadff.sh
#Rebuilds the SO-ChatBot from git master, then restarts the bot -- PHANTOMJS VERSION.
cd SO-ChatBot; git pull; cd ..; ./reloadpjs.sh
#!/bin/sh
# reloads the bot - rebuilds it then restarts it -- FIREFOX VERSION.
basedir=~/dev;
cd $basedir/SO-ChatBot;
node build.js;
cp $basedir/SO-ChatBot/master.min.js $basedir/so-chatbot-driver;
exec $basedir/restartff.sh
cd $basedir;
#!/bin/sh
# reloads the bot - rebuilds it then restarts it -- PHANTOMJS VERSION.
basedir=~/dev;
cd $basedir/SO-ChatBot;
node build.js;
cp $basedir/SO-ChatBot/master.min.js $basedir/so-chatbot-driver;
exec $basedir/restartpjs.sh
cd $basedir;
#!/bin/sh
# restarts the bot without changing anything -- FIREFOX VERSION.
basedir=~/dev;
#Kill stuff - for Firefox
killall firefox iceweasel 2>&1 > /dev/null
sleep 2
killall -9 firefox iceweasel 2>&1 > /dev/null
sleep 2
cd $basedir/so-chatbot-driver
killall -9 phantomjs java firefox 2>&1 > /dev/null
./startff.sh $1;
cd $basedir
#!/bin/sh
# restarts the bot without rebuilding the SO-ChatBot code - PHANTOMJS VERSION.
#change basedir if SO-ChatBot directory and so-chatbot-driver directory are not in $HOME/dev
basedir=~/dev;
cd $basedir/so-chatbot-driver
killall -9 phantomjs java firefox 2>&1 > /dev/null
./startpjs.sh $1;
cd $basedir
#!/bin/bash
###FOR FIREFOX -- If you want to run PhantomJS, ignore this file###
#example if you want to run Firefox -- you need to start an X server of some sort (Xvfb, Xrdp, etc.) first and then get its display and export it like this
export DISPLAY=:12
if [ -z $1 ]; then export SCREENCMD="screen -mdS so-chatbot-driver"; fi;
#You'll need to provide the path to the firefox binary with the --browser-path argument, and -x is the path to the persistent profile directory where Firefox will store the user profile
$SCREENCMD java -jar so-chatbot-driver.jar -b master.min.js -c "http://chat.stackexchange.com/rooms/118/root-access" -u "you@gmail.com" -p 'password' -f --browser-path=/opt/firefox23.0.1/firefox -x profiledir
#!/bin/bash
#Start script for starting so-chatbot-driver ***FOR PHANTOMJS.***
if [ -z $1 ]; then export SCREENCMD="screen -mdS so-chatbot-driver"; fi;
#Things to change:
#(1) the URL should be the chat you want it to start in as its parent chat
#(2) the email address for the username
#(3) the password after the -p argument
$SCREENCMD java -jar so-chatbot-driver.jar -b master.min.js -c "http://chat.stackexchange.com/rooms/118/root-access" -u "email@gmail.com" -p 'password' -j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment