From acfcc9e86050d370c7c510aa94bc80ebf5961edd Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Wed, 18 Feb 2009 18:45:36 +0000 Subject: [PATCH] wrong name. --- monitor-runlevelagent.init | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 monitor-runlevelagent.init diff --git a/monitor-runlevelagent.init b/monitor-runlevelagent.init new file mode 100644 index 0000000..f22d587 --- /dev/null +++ b/monitor-runlevelagent.init @@ -0,0 +1,50 @@ +#!/bin/bash +# +# monitor-runlevelagent starts the RunlevelAgent in production mode. +# +# Load before nm, vcached, and vservers, vserver-reference +# chkconfig: 3 14 85 +# description: Start RunlevelAgent to report the current Runlevel to PLC at +# periodic intervals. +# +# Stephen Soltesz +# Copyright (C) 2008 The Trustees of Princeton University +# +# $Id$ +# + +case "$1" in + start|restart|reload) + ;; + stop|status) + exit 0 + ;; + *) + echo $"Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +# NOTE: If user already exists, this just exists with status 9. I think it's +# ok to simply let this command check and error out. +# Parse PLC configuration +if [ -r /etc/planetlab/plc_config ] ; then + . /etc/planetlab/plc_config +else + PLC_NAME="PlanetLab" + PLC_SLICE_PREFIX="pl" + PLC_BOOT_HOST="boot.planet-lab.org" +fi + +USER="${PLC_SLICE_PREFIX}_monitor" +/usr/sbin/useradd -p "" -m $USER &> /dev/null || : + +if [ ! -d /home/$USER/.ssh ] ; then + mkdir /home/$USER/.ssh + chmod 700 /home/$USER/.ssh + chown $USER.$USER /home/$USER/.ssh +fi + +URL="http://${PLC_BOOT_HOST}/PlanetLabConf/keys.php?$USER" +curl -s "$URL" > /home/$USER/.ssh/authorized_keys +chown $USER.$USER /home/$USER/.ssh/authorized_keys -- 2.43.0