有人可以幫我在啟動時製作多螢幕命令的腳本嗎
這就是它是什麼
cd /home/bhop1/serverfiles
screen ./srcds_run -console -game cstrike -tickrate 100 -pingboost 2 +map bhop_eazy -maxplayers 32 -port 27015
cd /home/mg/serverfiles
screen ./srcds_run -console -game cstrike -tickrate 100 -pingboost 2 +map mg_100traps_v3 -maxplayers 32 -port 27016
screen ./srcds_run -console -game cstrike -pingboost 2 +map de_dust2 -maxplayers 32 -port 27017
cd /home/caln3/serverfiles
screen ./srcds_run -console -game cstrike -pingboost 2 +map de_dust2 -maxplayers 32 -port 27018
cd /home/clan1/serverfiles
screen ./srcds_run -console -game cstrike -pingboost 2 +map de_dust2 -maxplayers 32 -port 27019
cd /home/clan2/serverfiles
screen ./srcds_run -console -game cstrike -pingboost 2 +map ze_minecraft_v1 -maxplayers 32 -port 27020
cd /home/ze/serverfiles
screen ./srcds_run -console -game cstrike -pingboost 2 +map zm_cbble_b4_5 -maxplayers 32 -port 27021
cd /home/zm/serverfiles
-謝謝
有什麼不對?
# !/bin/bash
alias cdproj="cd /home/bhop1/serverfiles"
screen -dmS bhop ./srcds_run -console -game cstrike -tickrate 100 -pingboost 2 +map bhop_eazy -maxplayers 32 -port 27015
alias cdproj="cd /home/mg/serverfiles"
screen -dmS MG ./srcds_run -console -game cstrike -tickrate 100 -pingboost 2 +map mg_100traps_v3 -maxplayers 32 -port 27016
alias cdproj="cd /home/caln3/serverfiles"
screen -dmS clan1 ./srcds_run -console -game cstrike -pingboost 2 +map de_dust2 -maxplayers 32 -port 27017
alias cdproj="cd /home/clan1/serverfiles"
screen -dmS clan2 ./srcds_run -console -game cstrike -pingboost 2 +map de_dust2 -maxplayers 32 -port 27018
alias cdproj="cd /home/clan2/serverfiles"
screen -dmS clan3 ./srcds_run -console -game cstrike -pingboost 2 +map de_dust2 -maxplayers 32 -port 27019
alias cdproj="cd /home/ze/serverfiles"
screen -dmS ZE ./srcds_run -console -game cstrike -pingboost 2 +map ze_minecraft_v1_1 -maxplayers 32 -port 27020
alias cdproj="cd /home/zm/serverfiles"
screen -dmS -ZM ./srcds_run -console -game cstrike -pingboost 2 +map zm_cbble_b4_5 -maxplayers 32 -port 27021
答案1
從man screen
:
-dmS name Start as daemon: Screen session in detached mode.
-r Reattach to a detached screen process.
因此,您可以使用名稱在自己的螢幕守護程式中啟動每個命令,例如:
screen -dmS port27015 ./srcds_run -console -game cstrike -tickrate 100 -pingboost 2 +map bhop_eazy -maxplayers 32 -port 27015
現在您可以使用以下命令恢復此畫面:
screen -r port27015
我想這就是你要找的。只需確保為每個螢幕守護程式使用唯一的名稱,否則螢幕將無法知道您要重新附加哪個螢幕。
筆記:您應該使用CTRL+ A+D來分離螢幕。任何其他組合鍵或命令可能只會殺死螢幕及其內部運行的進程。