스크립트 질문
작성자 정보
- 임성호 작성
- 작성일
컨텐츠 정보
- 1,931 조회
- 0 추천
- 목록
본문
안녕하세요 다음 스크립트를 봐 주세요.
참고로 제가 만든 스크립트는 아니며 주석도 같이 첨부합니다.
#!/bin/sh
#
# CircleMUD 3.0 autorun script
# Contributions by Fred Merkel, Stuart Lamble, and Jeremy Elson
# Copyright (c) 1996 The Trustees of The Johns Hopkins University
# All Rights Reserved
# See license.doc for more information
#
#############################################################################
#
# This script can be used to run CircleMUD over and over again (i.e., have it
# automatically reboot if it crashes). It will run the game, and copy some
# of the more useful information from the system logs to the 'log' directory
# for safe keeping.
#
# You can control the operation of this script by creating and deleting files
# in Circle's root directory, either manually or by using the 'shutdown'
# command from within the MUD.
#
# Creating a file called .fastboot makes the script wait only 5 seconds
# between reboot attempts instead of the usual 200. If you want a quick
# reboot, use the "shutdown reboot" command from within the MUD.
#
# Creating a file called .killscript makes the script terminate (i.e., stop
# rebooting the MUD). If you want to shut down the MUD and make it stay
# shut down, use the "shutdown die" command from within the MUD.
#
# Finally, if a file called pause exists, the script will not reboot the MUD
# again until pause is removed. This is useful if you want to turn the MUD
# off for a couple of minutes and then bring it back up without killing the
# script. Type "shutdown pause" from within the MUD to activate this feature.
#
# The port on which to run the MUD
# ?ы듃踰덊샇瑜??곸뼱二쇱꽭??^^
PORT=
# Default flags to pass to the MUD server (see running.doc for a description
# of all flags).
FLAGS='-q'
#############################################################################
while ( : ) do
DATE=`date`
echo "autorun starting game $DATE" >> syslog
echo "running bin/circle $FLAGS $PORT" >> syslog
bin/circle $FLAGS $PORT >> syslog 2>&1
tail -30 syslog > syslog.CRASH
fgrep "self-delete" syslog >> log/delete
fgrep "death trap" syslog >> log/dts
fgrep "killed" syslog >> log/rip
fgrep "Running" syslog >> log/restarts
fgrep "advanced" syslog >> log/levels
fgrep "equipment lost" syslog >> log/rentgone
fgrep "usage" syslog >> log/usage
fgrep "new player" syslog >> log/newplayers
fgrep "SYSERR" syslog >> log/errors
fgrep "(GC)" syslog >> log/godcmds
fgrep "Bad PW" syslog >> log/badpws
rm log/syslog.1
mv log/syslog.2 log/syslog.1
mv log/syslog.3 log/syslog.2
mv log/syslog.4 log/syslog.3
mv log/syslog.5 log/syslog.4
mv log/syslog.6 log/syslog.5
mv syslog log/syslog.6
touch syslog
if [ ! -r .fastboot ]; then
sleep 10
else
rm .fastboot
sleep 5
fi
if [ -r .killscript ]; then
DATE=`date`;
echo "autoscript killed $DATE" >> syslog
rm -rf .killscript
exit
fi
while [ -r pause ]; do
sleep 10
done
done
이 스크립트에서 프로세스가 죽으면 다시 실행하게 하고 싶습니다.
서버이기때문에 설사 죽더라도 1에서 3초 내에 실행되어야 합니다.
답변 부탁합니다.
참고로 스크립트가 원하는 실행파일은 user/nw/bin에 있습니다.
참고로 user은 저의 홈 디렉토리 입니다.
관련자료
-
이전
-
다음