Skip to content

Instantly share code, notes, and snippets.

@that4chanwolf
Created April 20, 2012 16:54
Show Gist options
  • Save that4chanwolf/2430266 to your computer and use it in GitHub Desktop.
Save that4chanwolf/2430266 to your computer and use it in GitHub Desktop.
Shimeji script
#!/bin/bash
# A bash script meant to be used along with linux-shimeji
# Requires linux-shimeji (obviously) and either xcompmgr or compton (for compositing)
shimejijar="/opt/linux-shimeji/Shimeji.jar"
if [ -n `which java` ]; then
echo 'ERROR: No Java install found! Please install a JRE.'
exit
fi
if [ -n `which compton` ]; then
compcommand=`which compton`
elif [ -n `which xcompmgr` ]; then
compcommand=`which xcompmgr`
else
echo 'ERROR: No compositor found! Exiting.'
exit
fi
case $1 in
start)
bash -c "
${compcommand} &
`which java` -jar ${shimejijar} &
exit &
" > /dev/null
echo 'Starting Shimeji...'
;;
stop)
bash -c "
kill $(ps aux | grep 'Shimeji.jar' | awk '{ print $2 }' | grep `pidof java`) &
killall ${compcommand} &
" > /dev/null
echo 'Shutting down Shimeji...'
;;
restart)
bash -c "
kill $(ps aux | grep 'Shimeji.jar' | awk '{ print $2 }' | grep `pidof java`) &&
`which java` -jar ${shimejijar} &
exit &
" > /dev/null
echo 'Restarting Shimeji...'
;;
*)
echo 'Usage: shimeji.sh (start|stop|restart)'
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment