add /etc/init.d/conf_files to update conf files once at startup
authorMark Huang <mlhuang@cs.princeton.edu>
Sat, 18 Nov 2006 18:43:18 +0000 (18:43 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Sat, 18 Nov 2006 18:43:18 +0000 (18:43 +0000)
NodeManager.spec
conf_files.init [new file with mode: 0644]

index 5e2fea0..c5f2f40 100644 (file)
@@ -44,10 +44,13 @@ local operations on slices.
 rm -rf $RPM_BUILD_ROOT
 %{__make} %{?_smp_mflags} install DESTDIR="$RPM_BUILD_ROOT"
 
+install -D -m 755 conf_files.init $RPM_BUILD_ROOT/%{_initrddir}/conf_files
 install -D -m 755 nm.init $RPM_BUILD_ROOT/%{_initrddir}/nm
 install -D -m 644 nm.logrotate $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/nm
 
 %post
+chkconfig --add conf_files
+chkconfig conf_files on
 chkconfig --add nm
 chkconfig nm on
 
@@ -56,6 +59,8 @@ chkconfig nm on
 if [ $1 -eq 0 ] ; then
     chkconfig nm off
     chkconfig --del nm
+    chkconfig conf_files off
+    chkconfig --del conf_files
 fi
 
 %clean
@@ -68,6 +73,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/NodeManager/*
 %{_bindir}/forward_api_calls
 %{_initrddir}/nm
+%{_initrddir}/conf_files
 %{_sysconfdir}/logrotate.d/nm
 
 %changelog
diff --git a/conf_files.init b/conf_files.init
new file mode 100644 (file)
index 0000000..887d4fe
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# conf_files       Updates node configuration files at startup
+#
+# chkconfig: 3 20 80
+# description: Updates node configuration files at startup
+#
+# $Id: nm.init,v 1.1 2006/11/13 20:04:44 mlhuang Exp $
+
+# Source function library.
+. /etc/init.d/functions
+
+case "$1" in
+    start|restart|reload)
+       action $"Updating node configuration files: " python /usr/share/NodeManager/conf_files.py
+       ;;
+    *)
+       echo $"Usage: $0 {start|restart}"
+       exit 1
+esac
+
+exit 0