Skip to content

Commit 63e4b4b

Browse files
committed
+ added PID support
+ mineos initscript improved presentation of login page
1 parent 70761f2 commit 63e4b4b

File tree

3 files changed

+101
-7
lines changed

3 files changed

+101
-7
lines changed

login.html

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@
6666
<!--/ END Logo -->
6767

6868
<!-- Avatar -->
69-
<div class="avatar">
70-
<h5 align="center">Admin Login</h5>
69+
<div class="">
70+
<h5 align="center">Web User Interface Login</h5>
7171
</div><!--/ Avatar -->
7272

7373
<!-- Username -->
7474
<div class="control-group">
7575
<div class="controls">
76-
<input type="text" name="username" placeholder="Username" class="span12"><i class="icon-user input-icon"></i>
76+
<input type="text" name="username" autocomplete="off" placeholder="Username" class="span12"><i class="icon-user input-icon"></i>
7777
</div>
7878
</div><!--/ Username -->
7979

@@ -87,19 +87,24 @@ <h5 align="center">Admin Login</h5>
8787
<!-- Checkbox -->
8888
<div class="control-group">
8989
<div class="controls">
90-
<label class="checkbox styled">
91-
<input type="checkbox" name="hide"> Hide password
92-
</label>
90+
<span>
91+
<label class="checkbox styled pull-left">
92+
<input type="checkbox" name="hide"> Hide password
93+
</label>
94+
<a class="pull-left" href="http://www.nngroup.com/articles/stop-password-masking/">&nbsp;(?)</a>
95+
</span>
96+
9397
</div>
9498
</div><!--/ Checkbox -->
95-
9699
</div>
97100
<!-- Form Action -->
98101
<!-- Place out form `.body-inner` -->
99102
<div class="form-actions">
100103
<button type="submit" class="btn btn-primary span12">Login</button>
101104
</div>
102105
<!--/ Form Action -->
106+
107+
<p align="center">The web user interface authenticates on your SSH username/password.</p>
103108
</section>
104109
</form>
105110
<!--/ END Login Widget Form -->

mineos

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/sh
2+
3+
### BEGIN INIT INFO
4+
# Provides: mineos
5+
# Required-Start: $all
6+
# Required-Stop: $network
7+
# Default-Start: 2 3 4 5
8+
# Default-Stop: 0 1 6
9+
# Short-Description: MineOS webui
10+
# Description: A web-based administration interface for Unix systems
11+
### END INIT INFO
12+
13+
NAME=mineos
14+
PIDFILE=/var/run/mineos.pid
15+
SERVER=/usr/games/minecraft/server.py
16+
DATAPATH=/var/games/minecraft
17+
18+
set -e
19+
. /lib/lsb/init-functions
20+
21+
case "$1" in
22+
'start')
23+
if [ -s $PIDFILE ]; then
24+
kill -0 `cat $PIDFILE` >/dev/null 2>&1
25+
if [ "$?" = "0" ]; then
26+
echo "$NAME (pid `cat $PIDFILE`) is already running."
27+
RETVAL=0
28+
else
29+
rm -- $PIDFILE
30+
log_begin_msg "Starting $NAME... "
31+
python $SERVER --daemon -d $DATAPATH >/dev/null 2>&1 </dev/null
32+
RETVAL=$?
33+
log_action_end_msg $RETVAL
34+
fi
35+
else
36+
log_begin_msg "Starting $NAME... "
37+
python $SERVER --daemon -d $DATAPATH >/dev/null 2>&1 </dev/null
38+
RETVAL=$?
39+
log_action_end_msg $RETVAL
40+
fi
41+
;;
42+
43+
'stop')
44+
if [ -s $PIDFILE ]; then
45+
log_begin_msg "Stopping $NAME... "
46+
kill -s INT `cat $PIDFILE` >/dev/null 2>&1
47+
rm -- $PIDFILE
48+
RETVAL=$?
49+
log_action_end_msg $RETVAL
50+
else
51+
echo "$NAME is not running."
52+
fi
53+
;;
54+
55+
'status')
56+
if [ -s $PIDFILE ]; then
57+
kill -0 `cat $PIDFILE` >/dev/null 2>&1
58+
if [ "$?" = "0" ]; then
59+
echo "$NAME (pid `cat $PIDFILE`) is running."
60+
RETVAL=0
61+
else
62+
echo "$NAME is stopped."
63+
RETVAL=1
64+
fi
65+
else
66+
echo "$NAME is stopped."
67+
RETVAL=1
68+
fi
69+
;;
70+
*)
71+
echo "Usage: $0 { start | stop }"
72+
RETVAL=1
73+
;;
74+
esac
75+
exit $RETVAL
76+

server.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ def check_interval(self):
4949
action='store_true',
5050
default=False,
5151
help='run server as a daemon')
52+
parser.add_argument('--nopid',
53+
action='store_true',
54+
default=False,
55+
help='do not use a PID file')
5256
parser.add_argument('-s',
5357
dest='cert_files',
5458
help='certificate files: /etc/ssl/certs/cert.crt,/etc/ssl/certs/cert.key',
@@ -133,6 +137,15 @@ def check_interval(self):
133137
from cherrypy.process.plugins import Daemonizer
134138
Daemonizer(cherrypy.engine).subscribe()
135139

140+
if args.nopid is False:
141+
from cherrypy.process.plugins import PIDFile
142+
PIDFile(cherrypy.engine, '/var/run/mineos.pid').subscribe()
143+
144+
if os.path.isfile('/var/run/mineos.pid'):
145+
import sys
146+
print 'MineOS instance already running (PID found)'
147+
sys.exit(1)
148+
136149
minute_crontab = cherrypy.process.plugins.Monitor(cherrypy.engine, cron(base_dir).check_interval, 60)
137150
minute_crontab.subscribe()
138151

0 commit comments

Comments
 (0)