Advertisement
mikxqc

Untitled

Sep 5th, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.18 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. game=7daystodie
  4. steam_user="$2"
  5. steam_pass="$3"
  6. steamid=294420
  7.  
  8. telport=8081
  9. telpass=""
  10.  
  11. telnetCommand() {
  12.     nc 127.0.0.1 ${telport} &
  13.     printf "${telpass}\n$c\n"
  14.     printf "exit\n"
  15. }
  16.  
  17. if [ "$1" == "live" ]; then
  18.     echo "[Mx7Days] Selected branch is LIVE"
  19.     sub=mx7days
  20.  
  21.     if [ "$2" == "start" ]; then
  22.         echo "[Mx7Days] Starting LIVE..."
  23.         tmux new-session -d -s ${sub}
  24.         tmux send-keys -t ${sub} "cd /home/gaming/${game}/${sub}" Enter
  25.         tmux send-keys -t ${sub} "./startserver.sh -configfile=serverconfig.xml" Enter
  26.         sleep 10
  27.         echo "[Mx7Days] LIVE started."
  28.     fi
  29.  
  30.     if [ "$2" == "stop" ]; then
  31.         echo "[Mx7Days] Stopping LIVE..."
  32.         tmux send-keys -t ${sub} C-c
  33.         sleep 10
  34.         tmux kill-session -t ${sub}
  35.         echo "[Mx7Days] LIVE stopped."
  36.     fi
  37.    
  38.     if [ "$2" == "install" ]; then
  39.         echo "[Mx7Days] Installing LIVE..."
  40.         cd /home/steamcmd
  41.         ./steamcmd.sh +login anonymous +force_install_dir /home/gaming/${game}/${sub} +app_update ${steamid} validate +quit
  42.         echo "[Mx7Days] LIVE installed."
  43.     fi
  44.    
  45.     if [ "$2" == "console" ]; then
  46.         tmux a -t ${sub}
  47.     fi
  48.    
  49.     if [ "$2" == "message" ]; then
  50.         r=$(( $RANDOM % 4 ));
  51.         case "$r" in
  52.             '1')
  53.                 telnetCommand $c "say Mx7Days redémarre chaque jour à 5:00AM (Heure de Montréal)"
  54.                 ;;
  55.             '2')
  56.                 telnetCommand $c "say Besoin d'aide? Un tricheur? forum.mikx.ca"
  57.                 ;;
  58.             '3')
  59.                 telnetCommand $c "say Notre serveur TS3 : ts3.mikx.ca"
  60.                 ;;
  61.         esac
  62.     fi
  63.    
  64.     if [ "$2" == "sync" ]; then
  65.         cp -r /home/gaming/${game}/mx7days-dev/Data/Config/* /home/gaming/${game}/${sub}/Data/Config/
  66.     fi
  67.    
  68.     if [ "$2" == "reboot" ]; then
  69.         echo "[Mx7Days] Stopping LIVE..."
  70.         tmux send-keys -t ${sub} C-c
  71.         sleep 10
  72.         tmux kill-session -t ${sub}
  73.         echo "[Mx7Days] LIVE stopped."
  74.        
  75.         echo "[Mx7Days] Starting LIVE..."
  76.         tmux new-session -d -s ${sub}
  77.         tmux send-keys -t ${sub} "cd /home/gaming/${game}/${sub}" Enter
  78.         tmux send-keys -t ${sub} "./startserver.sh -configfile=serverconfig.xml" Enter
  79.         sleep 10
  80.         echo "[Mx7Days] LIVE started."
  81.     fi
  82.  
  83. fi
  84.  
  85. if [ "$1" == "hard" ]; then
  86.     echo "[Mx7Days] Selected branch is HARD"
  87.     sub=mx7days-hard
  88.  
  89.     if [ "$2" == "start" ]; then
  90.         echo "[Mx7Days] Starting HARD..."
  91.         tmux new-session -d -s ${sub}
  92.         tmux send-keys -t ${sub} "cd /home/gaming/${game}/${sub}" Enter
  93.         tmux send-keys -t ${sub} "./startserver.sh -configfile=serverconfig.xml" Enter
  94.         sleep 10
  95.         echo "[Mx7Days] DEV started."
  96.     fi
  97.  
  98.     if [ "$2" == "stop" ]; then
  99.         echo "[Mx7Days] Stopping HARD..."
  100.         tmux send-keys -t ${sub} C-c
  101.         sleep 10
  102.         tmux kill-session -t ${sub}
  103.         echo "[Mx7Days] HARD stopped."
  104.     fi
  105.    
  106.     if [ "$2" == "install" ]; then
  107.         echo "[Mx7Days] Installing HARD..."
  108.         cd /home/steamcmd
  109.         ./steamcmd.sh +login anonymous +force_install_dir /home/gaming/${game}/${sub} +app_update ${steamid} validate +quit
  110.         echo "[Mx7Days] HARD installed."
  111.     fi
  112.    
  113.     if [ "$2" == "console" ]; then
  114.         tmux a -t ${sub}
  115.     fi
  116.    
  117.     if [ "$2" == "message" ]; then
  118.         r=$(( $RANDOM % 4 ));
  119.         case "$r" in
  120.             '1')
  121.                 telnetCommand $c "say Mx7Days redémarre chaque jour à 5:00AM (Heure de Montréal)"
  122.                 ;;
  123.             '2')
  124.                 telnetCommand $c "say Besoin d'aide? Un tricheur? http://forum.mikx.ca"
  125.                 ;;
  126.             '3')
  127.                 telnetCommand $c "say Notre serveur TS3 : ts3.mikx.ca"
  128.                 ;;
  129.         esac
  130.     fi
  131.    
  132.     if [ "$2" == "sync" ]; then
  133.         cp -r /home/gaming/${game}/mx7days-dev/Data/Config/* /home/gaming/${game}/${sub}/Data/Config/
  134.     fi
  135.    
  136.     if [ "$2" == "reboot" ]; then
  137.         echo "[Mx7Days] Stopping HARD..."
  138.         tmux send-keys -t ${sub} C-c
  139.         sleep 10
  140.         tmux kill-session -t ${sub}
  141.         echo "[Mx7Days] HARD stopped."
  142.        
  143.         echo "[Mx7Days] Starting HARD..."
  144.         tmux new-session -d -s ${sub}
  145.         tmux send-keys -t ${sub} "cd /home/gaming/${game}/${sub}" Enter
  146.         tmux send-keys -t ${sub} "./startserver.sh -configfile=serverconfig.xml" Enter
  147.         sleep 10
  148.         echo "[Mx7Days] HARD started."
  149.     fi
  150.  
  151. fi
  152.  
  153. if [ "$1" == "dev" ]; then
  154.     echo "[Mx7Days] Selected branch is DEV"
  155.     sub=mx7days-dev
  156.  
  157.     if [ "$2" == "start" ]; then
  158.         echo "[Mx7Days] Starting LIVE..."
  159.         tmux new-session -d -s ${sub}
  160.         tmux send-keys -t ${sub} "cd /home/gaming/${game}/${sub}" Enter
  161.         tmux send-keys -t ${sub} "./startserver.sh -configfile=serverconfig.xml" Enter
  162.         sleep 10
  163.         echo "[Mx7Days] DEV started."
  164.     fi
  165.  
  166.     if [ "$2" == "stop" ]; then
  167.         echo "[Mx7Days] Stopping DEV..."
  168.         tmux send-keys -t ${sub} C-c
  169.         sleep 10
  170.         tmux kill-session -t ${sub}
  171.         echo "[Mx7Days] DEV stopped."
  172.     fi
  173.    
  174.     if [ "$2" == "install" ]; then
  175.         echo "[Mx7Days] Installing DEV..."
  176.         cd /home/steamcmd
  177.         ./steamcmd.sh +login anonymous +force_install_dir /home/gaming/${game}/${sub} +app_update ${steamid} validate +quit
  178.         echo "[Mx7Days] DEV installed."
  179.     fi
  180.    
  181.     if [ "$2" == "console" ]; then
  182.         tmux a -t ${sub}
  183.     fi
  184.    
  185.     if [ "$2" == "message" ]; then
  186.         r=$(( $RANDOM % 4 ));
  187.         case "$r" in
  188.             '1')
  189.                 telnetCommand $c "say Mx7Days redémarre chaque jour à 5:00AM (Heure de Montréal)"
  190.                 ;;
  191.             '2')
  192.                 telnetCommand $c "say Besoin d'aide? Un tricheur? http://forum.mikx.ca"
  193.                 ;;
  194.             '3')
  195.                 telnetCommand $c "say Notre serveur TS3 : ts3.mikx.ca"
  196.                 ;;
  197.         esac
  198.     fi
  199.    
  200.     if [ "$2" == "sync" ]; then
  201.         cp -r /home/gaming/${game}/mx7days/Data/Config/* /home/gaming/${game}/${sub}/Data/Config/
  202.     fi
  203.  
  204. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement