SHARE
TWEET

Untitled

a guest Feb 17th, 2017 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. _start()
  4. {
  5.     cd lobby
  6.             screen -dmS lobby java -jar spigot-1.8.8.jar
  7.     cd ../
  8.     cd game
  9.             screen -dmS game java -jar spigot-1.8.8.jar
  10.         cd ../
  11.         cd bungee
  12.             screen -dmS bungee java -jar BungeeCord.jar
  13.         cd ../
  14.     exit 0
  15. }
  16.  
  17. _stop()
  18. {
  19.     SCREENID=$(screen -ls | grep -w lobby | cut -f 2)
  20.         if [ $SCREENID ]; then
  21.             screen -S lobby -p 0 -X stuff "`printf "stop\r"`"
  22.             while screen -ls | grep -w lobby > /dev/null
  23.                 do
  24.                     sleep .1
  25.                 done
  26.         else
  27.                 echo "lobby is not running"
  28.         fi
  29.         SCREENID=$(screen -ls | grep -w game | cut -f 2)
  30.         if [ $SCREENID ]; then
  31.                 screen -S game -p 0 -X stuff "`printf "stop\r"`"
  32.                 while screen -ls | grep -w game > /dev/null
  33.                 do
  34.                     sleep .1
  35.                 done
  36.         else
  37.                 echo "game is not running"
  38.         fi
  39.         SCREENID=$(screen -ls | grep -w bungee | cut -f 2)
  40.         if [ $SCREENID ]; then
  41.                 screen -S bungee -p 0 -X stuff "`printf "end\r"`"
  42.             while screen -ls | grep -w bungee > /dev/null
  43.                 do
  44.                     sleep .1
  45.                 done
  46.         else
  47.                 echo "bungee is not running"
  48.         fi
  49.     exit 0
  50. }
  51.  
  52. case $1 in
  53.         start)
  54.                 _start $2
  55.         ;;
  56.         stop)
  57.                 _stop $2
  58.         ;;
  59. esac
  60.  
  61. echo
  62. echo "Usage:"
  63. echo " ./network.sh [option]"
  64. echo
  65. echo "Options:"
  66. echo " start     Starts the network"
  67. echo " stop      Stops the network"
  68. exit 2
RAW Paste Data
Top