| 1 |
#!/bin/sh |
|---|
| 2 |
# |
|---|
| 3 |
# AsynCluster: Node Display Manager (NDM): |
|---|
| 4 |
# A simple X display manager for cluster nodes that also serve as |
|---|
| 5 |
# access-restricted workstations. An NDM client runs on each node and |
|---|
| 6 |
# communicates via Twisted's Perspective Broker to the Aysncluster server, |
|---|
| 7 |
# which regulates when and how much each user can use his account on any of the |
|---|
| 8 |
# workstations. The NDM server also dispatches cluster operations to the nodes |
|---|
| 9 |
# via the NDM clients, unbeknownst to the workstation users. |
|---|
| 10 |
# |
|---|
| 11 |
# Copyright (C) 2006-2007 by Edwin A. Suominen, http://www.eepatents.com |
|---|
| 12 |
# |
|---|
| 13 |
# This program is free software; you can redistribute it and/or modify it under |
|---|
| 14 |
# the terms of the GNU General Public License as published by the Free Software |
|---|
| 15 |
# Foundation; either version 2 of the License, or (at your option) any later |
|---|
| 16 |
# version. |
|---|
| 17 |
# |
|---|
| 18 |
# This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 19 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|---|
| 20 |
# FOR A PARTICULAR PURPOSE. See the file COPYING for more details. |
|---|
| 21 |
# |
|---|
| 22 |
# You should have received a copy of the GNU General Public License along with |
|---|
| 23 |
# this program; if not, write to the Free Software Foundation, Inc., 51 |
|---|
| 24 |
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|---|
| 25 |
|
|---|
| 26 |
# Call with a single mode-determining argument |
|---|
| 27 |
echo $@ |
|---|
| 28 |
if [ "$1" = "DAEMON" ] |
|---|
| 29 |
then |
|---|
| 30 |
# The Xinit (re)starter loop is what runs as the daemon |
|---|
| 31 |
export DISPLAY=:0 |
|---|
| 32 |
XINIT_ARGS="$0 PYTHON -- /usr/bin/X -ac -br +kb :0" |
|---|
| 33 |
while [ 1 ] |
|---|
| 34 |
do |
|---|
| 35 |
/usr/bin/xinit $XINIT_ARGS |
|---|
| 36 |
done |
|---|
| 37 |
|
|---|
| 38 |
elif [ "$1" = "PYTHON" ] |
|---|
| 39 |
then |
|---|
| 40 |
# Starts the Python interpreter as Xinit's sole X client |
|---|
| 41 |
exec python \ |
|---|
| 42 |
-c "from asyncluster.ndm import node; node.Manager()" 2>/dev/null |
|---|
| 43 |
|
|---|
| 44 |
else |
|---|
| 45 |
# Runs my Xinit (re)starter loop as a daemon |
|---|
| 46 |
/sbin/start-stop-daemon \ |
|---|
| 47 |
--background --quiet --start \ |
|---|
| 48 |
--pidfile /var/run/ndm --make-pidfile \ |
|---|
| 49 |
--startas "$0" DAEMON |
|---|
| 50 |
|
|---|
| 51 |
fi |
|---|