bash:使该脚本允许执行 php 解析器
目前我使用以下脚本启动 Armagetron 服务器
#!/bin/sh
tron="/home/duke/aa/bin/armagetronad-dedicated"
var="/home/duke/aa/servers/demo/var/"
log="${var}console_log.txt"
userconfigdir="/home/duke/aa/servers/demo/var/customize/config/"
parser="/home/duke/aa/scripts/parser.php"
ladderlog="${var}ladderlog.txt"
cmds="${var}cmd.txt"
tail -n0 -f -s 0.01 $ladderlog | $parser | $tron --userconfigdir $userconfigdir --vardir $var | tee -a $log
这将运行服务器并在 $parser 中应用 php 脚本
但是,我想像这样启动我的服务器:
#!/bin/bash
screen -S $1 -X quit # avoiding to run the same server twice
screen -dmS $1 /home/duke/aa/scripts/srv $1
srv:
screen -S $1 -X logtstamp on
screen -S $1 -X logfile /home/duke/aa/servers/$1/logs
screen -S $1 -X log on
while true; do # start a loop to allow server restart if it crashes
/home/duke/aa/bin/armagetronad-dedicated --vardir /home/duke/aa/servers/$1/var --userdatadir /home/duke/aa/servers/$1/var/customize #run the server
echo "###Server has crashed. Ctrl-C to cancel reboot...###"
sleep 5
done # end the loop
这里唯一的问题是我不知道如何指定 php解析器在服务器上运行(我是一个菜鸟)。我将如何修改第二个脚本以允许这样做?
Currently I start an Armagetron Server with the following script
#!/bin/sh
tron="/home/duke/aa/bin/armagetronad-dedicated"
var="/home/duke/aa/servers/demo/var/"
log="${var}console_log.txt"
userconfigdir="/home/duke/aa/servers/demo/var/customize/config/"
parser="/home/duke/aa/scripts/parser.php"
ladderlog="${var}ladderlog.txt"
cmds="${var}cmd.txt"
tail -n0 -f -s 0.01 $ladderlog | $parser | $tron --userconfigdir $userconfigdir --vardir $var | tee -a $log
This runs the server and applys the php script in $parser
However, I want to start my server like this:
#!/bin/bash
screen -S $1 -X quit # avoiding to run the same server twice
screen -dmS $1 /home/duke/aa/scripts/srv $1
srv:
screen -S $1 -X logtstamp on
screen -S $1 -X logfile /home/duke/aa/servers/$1/logs
screen -S $1 -X log on
while true; do # start a loop to allow server restart if it crashes
/home/duke/aa/bin/armagetronad-dedicated --vardir /home/duke/aa/servers/$1/var --userdatadir /home/duke/aa/servers/$1/var/customize #run the server
echo "###Server has crashed. Ctrl-C to cancel reboot...###"
sleep 5
done # end the loop
the only problem here is I don't know how to specify a php parser to run on the server (im a noob). How would i modify the second scripts to allow this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将第一个块中的所有代码放入 srv 脚本中的 while 循环内,即
srv:
(这看起来正确吗?)
我希望这会有所帮助。
put all the code in your first block inside the while loop in the srv script, i.e.
srv:
(Does this look right?)
I hope this helps.