From fb2d38cb57e3688f2f649a26c4259abc68482156 Mon Sep 17 00:00:00 2001 From: kueller Date: Tue, 20 Apr 2010 12:59:43 +0000 Subject: [PATCH] =?UTF-8?q?Zus=C3=A4tzliche=20Scripte=20f=C3=BCr=20den=20S?= =?UTF-8?q?ystemshutdown=20unter=20upstart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.compuextreme.de/Viitor/V962/Viitor_upstart@5507 504e572c-2e33-0410-9681-be2bf7408885 --- etc/init/halt.conf | 12 ++++++++++++ etc/init/ifdown.conf | 16 ++++++++++++++++ etc/init/reboot.conf | 11 +++++++++++ etc/init/sendsignals.conf | 13 +++++++++++++ etc/init/umountfs.conf | 22 ++++++++++++++++++++++ etc/init/umountnfs.conf | 20 ++++++++++++++++++++ etc/init/unloadmodules.conf | 28 ++++++++++++++++++++++++++++ 7 files changed, 122 insertions(+) create mode 100644 etc/init/halt.conf create mode 100644 etc/init/ifdown.conf create mode 100644 etc/init/reboot.conf create mode 100644 etc/init/sendsignals.conf create mode 100644 etc/init/umountfs.conf create mode 100644 etc/init/umountnfs.conf create mode 100644 etc/init/unloadmodules.conf diff --git a/etc/init/halt.conf b/etc/init/halt.conf new file mode 100644 index 0000000..595c76e --- /dev/null +++ b/etc/init/halt.conf @@ -0,0 +1,12 @@ +description "halt system to poweroff" +author "Harald Kueller " +version 1.0 +emits none special + +start on ( runlevel [0] and ( stopped udev )) + +console output +script + echo "System reboot in progress..." + /sbin/halt -f -p +end script diff --git a/etc/init/ifdown.conf b/etc/init/ifdown.conf new file mode 100644 index 0000000..e7c73eb --- /dev/null +++ b/etc/init/ifdown.conf @@ -0,0 +1,16 @@ +description "Shutdown all network interfaces without Loopback" +author "Harald Kueller " +version 1.0 +emits none special + +start on stopping udev + +console output + +script + echo "Stopping network" + for IF in `ls -d /sys/class/net/*[^lo]`; do + DEVNAME=`basename $IF` + /sbin/if_down $DEVNAME + done +end script diff --git a/etc/init/reboot.conf b/etc/init/reboot.conf new file mode 100644 index 0000000..99c3262 --- /dev/null +++ b/etc/init/reboot.conf @@ -0,0 +1,11 @@ +description "Force a reboot after all daemons are down" +author "Harald Kueller " +version 1.0 +emits none special + +start on ( runlevel [6] and ( stopped udev )) + +script + echo "System reboot in progress..." + /sbin/reboot -f +end script diff --git a/etc/init/sendsignals.conf b/etc/init/sendsignals.conf new file mode 100644 index 0000000..7ca55b2 --- /dev/null +++ b/etc/init/sendsignals.conf @@ -0,0 +1,13 @@ +description "Send all remaining prozesses the kill signal" +author "Harald Kueller " +version 1.0 +emits none special + +start on stopped udev + +script + echo -n "sending all remaining processes the TERM signal" + killall -15 + sleep 3 + killall -9 +end script diff --git a/etc/init/umountfs.conf b/etc/init/umountfs.conf new file mode 100644 index 0000000..87c41f0 --- /dev/null +++ b/etc/init/umountfs.conf @@ -0,0 +1,22 @@ +description "Umount all Filesystems, and turn off swap" +author "Harald Kueller " +version 1.0 +emits none special + +stop on (runlevel[06] and (stopped udev)) + +stop on runlevel 6 +stop on runlevel 0 + +console none +script + source /etc/init/functions + + echo -n "Deactivating swap..." + /sbin/swapoff -a + evaluate_retval + + echo -n "Unmounting file systems..." + /bin/umount -a -r + evaluate_retval +end script diff --git a/etc/init/umountnfs.conf b/etc/init/umountnfs.conf new file mode 100644 index 0000000..87763f9 --- /dev/null +++ b/etc/init/umountnfs.conf @@ -0,0 +1,20 @@ +description "Mounting NFS Filesystems" +author "Harald Kueller " +version 1.0 +emits none special + +start on stopping nfsclient + +console output + +script + source /etc/init/functions + for i in `sed -e "/^#/d" /etc/fstab|awk '{print $2}'`; do + MOUNTPOINT=$i + FILESYSTEM=`awk '{if( $2 == "'$MOUNTPOINT'") print $3}' /etc/fstab` + if [ "$FILESYSTEM" == "nfs" ]; then + umount $MOUNTPOINT + status_message "umount NFS Filesystem from $MOUNTPOINT" + fi + done +end script diff --git a/etc/init/unloadmodules.conf b/etc/init/unloadmodules.conf new file mode 100644 index 0000000..a9b883d --- /dev/null +++ b/etc/init/unloadmodules.conf @@ -0,0 +1,28 @@ +description "Unload all Kernel Modules" +author "Harald Kueller " +version 1.0 +emits none special + +start on stopping udev + +script + if [ -f /etc/sysconfig/loadmods ]; then + Z=0 + while [ "$Z" "<" "9" ]; do + exec 3/dev/null; then + print_status success + else + if [ "$Z" == "8" ]; then + print_status failure + else + echo "failed" + fi + fi + done + (( Z = $Z + 1 )) + exec 3>&- + done + fi +end script