我制作了一个.SH
如下所示的文件:
让人们知道服务器将要重新启动:
tmux send-keys -t VHS "/say §cServer restarting in §l30 minutes. §rPlease get ready to log off." Enter
# Wait for 1770 seconds (29 minutes and 30 seconds)
sleep 1770s
向服务器发送重启倒计时消息:
tmux send-keys -t VHS "/say §cServer is restarting in §l30 seconds! §rthe restart will take aproximately 5 minutes!" Enter
sleep 20s
tmux send-keys -t VHS "/say §cServer is restarting in §l10 seconds!" Enter
sleep 5s
tmux send-keys -t VHS "/say §cServer is restarting in §l5 seconds!" Enter
sleep 1s
tmux send-keys -t VHS "/say §cServer is restarting in §l4 seconds!" Enter
sleep 1s
tmux send-keys -t VHS "/say §cServer is restarting in §l3 seconds!" Enter
sleep 1s
tmux send-keys -t VHS "/say §cServer is restarting in §l2 seconds!" Enter
sleep 1s
tmux send-keys -t VHS "/say §cServer is restarting in §l1 second!" Enter
sleep 1s
停止 Minecraft 服务器:
tmux send-keys -t VHS "/stop" Enter
sleep 300s
使用脚本重新启动服务器run.sh
:
tmux send-keys -t VHS "./run.sh" Enter
我为 crontab 编写的代码行如下所示:
0 21 * * * /VHServer/restart.sh
该.sh
文件似乎运行了除/stop
命令和可能./run.sh
为服务器设置的所有内容,可以请我解释一下原因吗?