Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/WebUI/mtymgr

Parent Directory Parent Directory | Revision Log Revision Log


Revision 201 - (show annotations) (download)
Fri Jul 18 03:39:30 2008 UTC (15 years, 10 months ago) by notanpe
File size: 2346 byte(s)
足りないファイルを追加して、若干の更新も。
1 #!/bin/sh
2 MTYDIR="/home/mty"
3 MTYSTDERR="stderr.log"
4 MTYLOG="log.txt"
5 MTYTARG="target.txt"
6 CONFDIR="/home/config"
7
8 mtystart()
9 {
10 ./mty > /dev/null 2> "$MTYSTDERR" &
11 }
12
13 mtystop()
14 {
15 PSRES="`pgrep -x mty`"
16 if [ "$PSRES" != "" ]; then
17 kill $PSRES
18 fi
19 }
20
21 mtystatus()
22 {
23 PSRES="`pgrep -x mty`"
24 if [ "$PSRES" != "" ]; then
25 # ps up $PSRES
26 ps -o pcpu,pmem,start,comm -p $PSRES
27 else
28 echo "動いていません。"
29 fi
30 }
31
32 htmlhead()
33 {
34 cat << EOHTMLHEAD
35 Content-type: text/html
36
37 <html>
38 <head>
39 <title>$1</title>
40 </head>
41
42 <body bgcolor="fff8e7" text="000000">
43 <pre>
44 EOHTMLHEAD
45 }
46
47 htmltail()
48 {
49 cat << EOHTMLTAIL
50 </pre>
51 </body>
52 </html>
53 EOHTMLTAIL
54 }
55
56 main()
57 {
58 cd "$MTYDIR"
59
60 case "$0" in
61 *mtystart)
62 htmlhead 開始
63 mtystop
64 mtystart
65 mtystatus
66 htmltail
67 ;;
68 *mtystop)
69 htmlhead 停止
70 mtystop
71 echo "停止させました。"
72 htmltail
73 ;;
74 *mtystatus)
75 htmlhead 様子見
76 mtystatus
77 htmltail
78 ;;
79 *mtyspeed)
80 htmlhead 速度など
81 iconv -f CP932 -t utf-8 "$MTYSTDERR"
82 htmltail
83 ;;
84 *mtylog)
85 htmlhead 検索結果
86 if [ -s "$MTYLOG" ]; then
87 iconv -f CP932 -t utf-8 "$MTYLOG"
88 else
89 echo "まだなにもありません。"
90 fi
91 htmltail
92 ;;
93 *mtydel)
94 htmlhead "log.txt の削除"
95 PSRES="`pgrep -x mty`"
96 if [ "$PSRES" != "" ]; then
97 echo "待て屋を止めないと消せません。"
98 else
99 # TS="`date "+%Y%m%d%H%M%S"`"
100 # mv "$MTYLOG" "$MTYLOG"."$TS"
101 rm "$MTYLOG"
102 echo "削除しました。"
103 fi
104 htmltail
105 ;;
106 *mtyup)
107 awk '{
108 gsub( "\r", "", $0 );
109 if ( NR == 1 ) {
110 delmline = $0;
111 getline;
112 getline;
113 getline;
114 } else if ( match( $0, delmline ) == 0 ) {
115 printf( "%s\n", $0 );
116 }
117 }' > "$MTYTARG"
118 htmlhead "target.txt の転送"
119 echo "target.txt を転送して、検索を開始しました。"
120 mtystop
121 mtystart
122 mtystatus
123 htmltail
124 ;;
125 *mtysetup)
126 htmlhead "このシステムの更新"
127 sudo /bin/chmod +x $CONFDIR/setup
128 sudo $CONFDIR/setup
129 sudo /bin/rm $CONFDIR/setup
130 htmltail
131 ;;
132 esac
133 }
134
135 main ${1+"$@"}
136 exit 0

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26