I think everyone who uses BungeeCord has encountered the problem of synchronizing commands between servers, yes you can use the CommandSync plugin, but for example it works fine for me first but after a while when I need to restart some server because of CommandSync the server does not start and I need to restart the BungeeCord server that's all earned . It was because of this problem that I decided to write this script because I did not find any alternatives to the CommandSync plugin.
The script is designed for servers running on Linux and for those who use the tmux / screen utility to zapuka servers in a separate session. If you do not use the tmux / screen utilitythe script will not work for you, to find out how to install and configure the tmux / screen utility for your server, click this link .
If the server you are on multiple hosting mozhyte you choose to send commands over SSH
To do this you have to open the script cmd in the notebook and follow the instructions as described in the script.
#! /bin/sh
comands=`until [ -z "$2" ]; do echo -n "$2 " ; shift; done`
server=`echo -n $1 | sed 's/,/ /g'`
tmux_console ()
{
serverall=`tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}'`
if [ $server = all ] > /dev/null 2>&1
then
for servers in $serverall
do
tmux send-keys -t $servers "$comands" Enter
# Чтоб включить синхронизацию по SSH необходимо розкоментировать фунцию ниже и заменить "пользователь, пароль и ип" на ваши данные.
# Если у вас несколько хостингов эту фунцию можно копировать и вставить неограниченное количество раз только подставлять свои данные.
# И предварительно установить утилиту sshpass (apt-get install sshpass -y / yum install sshpass -y).
# Также нужно закинуть скрипт cmd в домашний каталог пользователя на SSH сервере например если root (/root), если user (/home/user)
# sshpass -p "пароль" ssh -o StrictHostKeyChecking=no пользователь@ип "sh cmd $1 $comands"
# sshpass -p "пароль" ssh -o StrictHostKeyChecking=no пользователь@ип "sh cmd $1 $comands"
done
elif [ $server = shell ] > /dev/null 2>&1
then
$comands
else
for servers in $server
do
tmux send-keys -t $servers "$comands" Enter
# sshpass -p "пароль" ssh -o StrictHostKeyChecking=no пользователь@ип "sh cmd $1 $comands"
# sshpass -p "пароль" ssh -o StrictHostKeyChecking=no пользователь@ип "sh cmd $1 $comands"
done
fi
}
screen_console ()
{
serverall=`screen -list | awk '{print substr($1, 0, length($1)-0)}'`
if [ $server = all ] > /dev/null 2>&1
then
for servers in $serverall
do
screen -p 0 -S $servers -X stuff "$comands^m"
# Чтоб включить синхронизацию по SSH необходимо розкоментировать фунцию ниже и заменить "пользователь, пароль и ип" на ваши данные.
# Если у вас несколько хостингов эту фунцию можно копировать и вставить неограниченное количество раз только подставлять свои данные.
# И предварительно установить утилиту sshpass (apt-get install sshpass -y / yum install sshpass -y).
# Также нужно закинуть скрипт cmd в домашний каталог пользователя на SSH сервере например если root (/root), если user (/home/user).
# sshpass -p "пароль" ssh -o StrictHostKeyChecking=no пользователь@ип "sh cmd $1 $comands"
# sshpass -p "пароль" ssh -o StrictHostKeyChecking=no пользователь@ип "sh cmd $1 $comands"
done
elif [ $server = shell ] > /dev/null 2>&1
then
$comands
else
for servers in $server
do
screen -p 0 -S $servers -X stuff "$comands^m"
# sshpass -p "пароль" ssh -o StrictHostKeyChecking=no пользователь@ип "sh cmd $1 $comands"
# sshpass -p "пароль" ssh -o StrictHostKeyChecking=no пользователь@ип "sh cmd $1 $comands"
done
fi
}
if [ -f ".cmd.conf" ]; then
console=`grep console .cmd.conf`
else
echo console=tmux > .cmd.conf
fi
if [ $server = screen ] > /dev/null 2>&1
then
sed -i s/$console/console="screen"/g .cmd.conf
elif [ $server = tmux ] > /dev/null 2>&1
then
sed -i s/$console/console="tmux"/g .cmd.conf
else
if [ $console = console="screen" ] > /dev/null 2>&1
then
screen_console > /dev/null 2>&1
else
tmux_console > /dev/null 2>&1
fi
fi
Commands:
/ sh cmd < name of the session under which the server runs > < command > - will send the command to the server / session you need.
/ sh cmd all < command > - send a command to all servers / sessions tmux / screen
/ sh cmd < server / session >, < server / session >, < server / session > < command > - send a command to several servers you need / sessions.
/ sh cmd shell < command > - send a command to the terminal / console of your hosting.
/ sh cmd tmux - you need to enter this command if you use the tmux utility .
/ sh cmd screen - you need to enter this command if you use the screen utility .
Dependencies:
Tmux / Screen
ScriptRunner
Installation:
Download and install the ScriptRunner plugin Download the script and upload the cmd file to the / plugins / ScriptRunner / minecraft server folder
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta