我有两个脚本,它们是从带有get动作的表单调用的。其中一个工作(调用messageserver.sh),另一个不工作。其中许多脚本都位于/ usr / bin中,包括似乎没有运行的脚本,restartark。它们都是从PuTTY运行的,没有问题。
<form action="http://xxxxx.servegame.com/messageserver.sh" method="get">
Message to Send: <input type="text" name="message"></input><br>
<input type="submit" name="subbtn" value="Submit">
</form>
<p>
<form action="http://xxxxx.servegame.com/restartserver.sh" method="get">
Restart Server with message: <input type="text" name="restartmessage"></input><br>
<input type="submit" name="subbtn" value="Submit">
</form>
restartserver.sh
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo "<title>Will take 10 minutes!!!</title>"
MESSAGE=`echo "$QUERY_STRING" | sed -n 's/^.*restartmessage=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"
MESSAGE=${MESSAGE//+/ }
echo "Trying to restart server with message:<br>$MESSAGE<p>"
restartark $MESSAGE
echo "</body></html"
exit 0
restartark
#!/bin/bash
cur_date=$(date +"%m.%d.%Y-%H.%M")
echo "<p>Restart initialized! 10 minutes... at $cur_date <br>" >> /ark2/arkstatus.txt
messageserver SERVER GOING DOWN IN 10 MINUTES $@
sleep 300
echo "Restarting in 5 minutes<br" >> /ark/arkstatus.txt
messageserver SERVER GOING DOWN FOR MAINTENANCE IN 5 MINUTES
sleep 60
messageserver SERVER GOING DOWN FOR MAINTENANCE IN 4 MINUTES
sleep 60
messageserver SERVER GOING DOWN FOR MAINTENANCE IN 3 MINUTES
sleep 60
echo "Restarting in 2 minutes<br>" >> /ark2/arkstatus.txt
messageserver SERVER GOING DOWN FOR MAINTENANCE IN 2 MINUTES
sleep 60
messageserver SERVER GOING DOWN FOR MAINTENANCE IN 1 MINUTE
sleep 60
echo "Restarting in 30 seconds<br>" >> /ark2/arkstatus.txt
messageserver SERVER GOING DOWN FOR MAINTENANCE IN 30 SECONDS
sleep 30
messageserver SERVER GOING DOWN FOR MAINTENANCE IN 15 SECONDS. LAST WARNING
sleep 15
cur_date=$(date +"%m.%d.%Y-%H.%M")
echo "Saving world... at $cur_date <br>" >> /ark2/arkstatus.txt
messageserver BRINGING SERVER DOWN NOW
sleep 3
killark
updateark
startark
答案 0 :(得分:0)
在restartserver.sh的第6行缺少反引号
应该开始在nano之外做我的所有编码...