[Lunar-commits] r19734 - in lunar-tools/tags: . lunar-tools-2006.1 lunar-tools-2006.1/lservices

Auke Kok sofar at lunar-linux.org
Wed Apr 19 20:14:50 UTC 2006


Author: sofar
Date: 2006-04-19 20:14:50 +0000 (Wed, 19 Apr 2006)
New Revision: 19734

Added:
   lunar-tools/tags/lunar-tools-2006.1/
   lunar-tools/tags/lunar-tools-2006.1/Makefile
   lunar-tools/tags/lunar-tools-2006.1/lservices/lservices
Removed:
   lunar-tools/tags/lunar-tools-2006.1/Makefile
   lunar-tools/tags/lunar-tools-2006.1/lservices/lservices
Log:
Tagging new release.


Copied: lunar-tools/tags/lunar-tools-2006.1 (from rev 19731, lunar-tools/trunk)

Deleted: lunar-tools/tags/lunar-tools-2006.1/Makefile

Copied: lunar-tools/tags/lunar-tools-2006.1/Makefile (from rev 19733, lunar-tools/trunk/Makefile)
===================================================================
--- lunar-tools/tags/lunar-tools-2006.1/Makefile	                        (rev 0)
+++ lunar-tools/tags/lunar-tools-2006.1/Makefile	2006-04-19 20:14:50 UTC (rev 19734)
@@ -0,0 +1,54 @@
+#
+# Makefile for lunar-tools - a collection of lunar-related shell tools
+#
+
+# versioning scheme: since this is mostly a linear process if incremental
+# but we do not update that often we use year.number as version number
+# i.e. 2004.9 2004.10 2004.11 ...
+VERSION = 2006.1
+
+PROGRAMS = lids/lids luser/luser lnet/lnet lservices/lservices lmodules/lmodules clad/clad
+DOCS = README COPYING ChangeLog
+MANPAGES = lnet/lnet.8
+PROFILEDFILES = clad/clad.rc
+
+BINDIR = /usr/bin/
+SBINDIR = /usr/sbin/
+MANDIR = /usr/share/man/
+DOCDIR = /usr/share/doc/lunar-tools/
+PROFILEDDIR = /etc/profile.d/
+
+all:
+install:
+	if [ ! -d "${SBINDIR}" ] ; then \
+	    mkdir -p ${SBINDIR} ; \
+	fi ; \
+	for PROGRAM in ${PROGRAMS} ; do \
+	    install -m755 $${PROGRAM} ${SBINDIR} ; \
+	done ; \
+	for MANPAGE in ${MANPAGES} ; do \
+	    EXT=`echo "$${MANPAGE:(($${#MANPAGE}-1)):1}"` ; \
+	    if [ ! -d "${MANDIR}man$$EXT" ] ; then \
+	        mkdir -p ${MANDIR}man$$EXT ; \
+	    fi ; \
+	    install -m644 $${MANPAGE} ${MANDIR}man$$EXT/ ; \
+	done ; \
+	if [ ! -d "${PROFILEDDIR}" ] ; then \
+	    mkdir -p ${PROFILEDDIR} ; \
+	fi ; \
+	for RCFILE in ${PROFILEDFILES} ; do \
+	    install -m644 $${RCFILE} ${PROFILEDDIR} ; \
+	done ; \
+	if [ ! -d "${DOCDIR}" ] ; then \
+		mkdir -p ${DOCDIR} ; \
+	fi ; \
+	for DOC in ${DOCS} ; do \
+		install -m644 $${DOC} ${DOCDIR} ; \
+	done
+
+log:
+	rm -f ChangeLog
+	svnlog > ChangeLog
+
+release:
+	tar cjvf /tmp/lunar-tools-${VERSION}.tar.bz2 --exclude="*/.svn*" -C .. lunar-tools-${VERSION}/ ; \

Deleted: lunar-tools/tags/lunar-tools-2006.1/lservices/lservices

Copied: lunar-tools/tags/lunar-tools-2006.1/lservices/lservices (from rev 19732, lunar-tools/trunk/lservices/lservices)
===================================================================
--- lunar-tools/tags/lunar-tools-2006.1/lservices/lservices	                        (rev 0)
+++ lunar-tools/tags/lunar-tools-2006.1/lservices/lservices	2006-04-19 20:14:50 UTC (rev 19734)
@@ -0,0 +1,156 @@
+#!/bin/bash
+############################################################
+#                                                          #
+# lservices - Lunar services management utility            #
+#                                                          #
+############################################################
+#                                                          #
+# Copyright Auke Kok 2004 under GPLv2                      #
+#                                                          #
+############################################################
+
+
+service_is_started() {
+  P=$(find $MOONBASE/*/*/init.d/ -type f -name $1 )
+  SECTION=$(echo $P | sed "s:$MOONBASE::g" | cut -d/ -f2)
+  MODULE=$(echo $P | sed "s:$MOONBASE::g" | cut -d/ -f3)
+
+  PIDF=$(grep '^# pidfile: ' /etc/init.d/$1 | cut -d: -f2 | sed 's/ //g' )
+  if [ -z "$PIDF" ] ; then
+    if grep -q '^# processname: ' /etc/init.d/$1 ; then
+      PIDF=/var/run/$(grep '^# processname: ' /etc/init.d/$1 | cut -d: -f2 | sed 's/ //g' ).pid
+    else
+      PIDF=/var/run/$1.pid
+    fi
+  fi
+
+  [ -e "$PIDF" ] && [ -d "/proc/$(cat $PIDF)" ] || pgrep -P 1 "^$1\$" > /dev/null
+}
+
+service_is_enabled() {
+  chkconfig --list | grep -w $1 | grep -qw '[0-9]:on'
+}
+
+service_menu() {(
+  #  stop      stop the service (currently started)
+  # or
+  #  start     start the service (currently stopped)
+  #  remove    remove the service from the startup sequence (currently added)
+  # or
+  #  add       add the service to the startup sequence (currently removed)
+
+  while true ; do
+    P=$(find $MOONBASE/*/*/init.d/ -type f -name $1 )
+    SECTION=$(echo $P | sed "s:$MOONBASE::g" | cut -d/ -f2)
+    MODULE=$(echo $P | sed "s:$MOONBASE::g" | cut -d/ -f3)
+
+    PIDF=$(grep '^# pidfile: ' /etc/init.d/$1 | cut -d: -f2 | sed 's/ //g' )
+    if [ -z "$PIDF" ] ; then
+      if grep -q '^# processname: ' /etc/init.d/$1 ; then
+        PIDF=/var/run/$(grep '^# processname: ' /etc/init.d/$1 | cut -d: -f2 | sed 's/ //g' ).pid
+      else
+        PIDF=/var/run/$1.pid
+      fi
+    fi
+    if service_is_started $1 ; then
+      TI1="stop"
+      OP1="stop the service (currently started)"
+    else
+      TI1="start"
+      OP1="start the service (currently stopped)"
+    fi
+    if service_is_enabled $1 ; then
+      TI2="remove"
+      OP2="remove the service from the startup sequence (currently added)"
+    else
+      TI2="add"
+      OP2="add the service to the startup sequence (currently removed)"
+    fi
+    action=`$DIALOG --title " Service actions for \"$1\" " \
+                  --ok-label "Go" \
+                  --cancel-label "Exit" \
+                  --menu ""  0 0 0 \
+  	  	  "$TI1" \
+		  "$OP1" \
+                  "$TI2" \
+		  "$OP2"`
+    if [ $? != 0 ] ; then
+      return
+    fi
+  
+    case $action in
+      start  )
+        /etc/init.d/$1 start
+	sleep 3
+      ;;
+      stop   )
+        /etc/init.d/$1 stop
+	sleep 3
+      ;;
+      add    )
+        chkconfig --add $1
+	set_module_config INITDSCRIPTS "$(get_module_config INITDSCRIPT) $1"
+      ;;
+      remove )
+        chkconfig --del $1
+	set_module_config INITDSCRIPTS "$(get_module_config INITDSCRIPTS | sed -e "s/^$1 / /g" -e "s/ $1 / /g" -e "s/^$1\$//g" -e "s/ $1\$/ /g")"
+      ;;
+    esac
+  done
+)}
+
+
+list_initd_services() {
+ (
+  unset IFS
+  for SERVICE in $(chkconfig --list | grep '0:' | cut -f1 | sort) ; do
+    if grep -q '^# chkconfig: ' /etc/init.d/$SERVICE ; then
+      DESCRIPTION="$(grep '^# description: ' /etc/init.d/$SERVICE | sed -e 's/^# description: //g' -e 's/\\/.../' -e 's/\t/ /g')"
+      if service_is_enabled $SERVICE ; then
+        FLAG="+"
+      else
+        FLAG="-"
+      fi
+      if service_is_started $SERVICE ; then
+        FLAG="${FLAG}1"
+      else
+        FLAG="${FLAG}0"
+      fi
+      echo "$SERVICE"
+      echo "$FLAG $DESCRIPTION"
+    fi
+  done
+ )
+}
+
+
+main_menu() {
+ while true ; do
+  action=`$DIALOG --title " Service boot configuration "    \
+                  --ok-label "Go"                 \
+		  --cancel-label "Exit"           \
+		  --menu                          \
+		  "( Legend: +=enabled, -=disabled, 1=started, 0=stopped)" \
+		  0 0 0                           \
+		  $(list_initd_services)`
+  if [ $? != 0 ] ; then
+    return
+  fi
+  service_menu $(echo $action | sed 's/ //g')
+ done
+}
+
+
+
+. /etc/lunar/config
+
+export IFS="$TAB_ENTER_IFS"
+export LC_ALL=C
+
+DIALOG="dialog
+--backtitle
+Lunar Services Management Utility
+--stdout"
+
+main_menu
+



More information about the Lunar-commits mailing list