atr 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. CURR_USER="$USER"
  3. STEAM_USER="steam"
  4. TMUX_SESSION="$STEAM_USER-rust"
  5. RUST_SERVER_PATH="/home/steam/rust/server"
  6. if [[ "$CURR_USER" != "$STEAM_USER" ]]; then
  7. echo "Not steam user! Try login to steam..."
  8. /bin/su $STEAM_USER
  9. exit
  10. fi
  11. SESSION_EXISTS=`/usr/bin/tmux ls | /bin/grep "$TMUX_SESSION"`
  12. if [[ "$SESSION_EXISTS" == "" ]]; then
  13. # Create
  14. /usr/bin/tmux new-session -d -s $TMUX_SESSION -n TOP
  15. /usr/bin/tmux new-window -t $TMUX_SESSION:1 -n APP
  16. /usr/bin/tmux new-window -t $TMUX_SESSION:2 -n LOGS
  17. /usr/bin/tmux new-window -t $TMUX_SESSION:3 -n MC1
  18. /usr/bin/tmux new-window -t $TMUX_SESSION:4 -n MC2
  19. /usr/bin/tmux new-window -t $TMUX_SESSION:5 -n SH
  20. /usr/bin/tmux send -t $TMUX_SESSION:0 "top" ENTER
  21. /usr/bin/tmux send -t $TMUX_SESSION:1 "cd $RUST_SERVER_PATH" ENTER
  22. /usr/bin/tmux send -t $TMUX_SESSION:1 "./run.sh"
  23. /usr/bin/tmux send -t $TMUX_SESSION:2 "tail -f $RUST_SERVER_PATH/gamelog.txt" ENTER
  24. /usr/bin/tmux send -t $TMUX_SESSION:3 "cd $RUST_SERVER_PATH;mc" ENTER
  25. /usr/bin/tmux send -t $TMUX_SESSION:4 "cd $RUST_SERVER_PATH;mc" ENTER
  26. /usr/bin/tmux send -t $TMUX_SESSION:5 "cd $RUST_SERVER_PATH" ENTER
  27. /usr/bin/tmux select-window -t $TMUX_SESSION:1
  28. /usr/bin/tmux attach-session -d -t $TMUX_SESSION
  29. else
  30. # Attach
  31. /usr/bin/tmux attach-session -d -t $TMUX_SESSION
  32. fi