summaryrefslogtreecommitdiffstats
path: root/remote
diff options
context:
space:
mode:
authorJonathan Bauer2014-03-11 17:01:11 +0100
committerJonathan Bauer2014-03-11 17:01:11 +0100
commitebb08909c987e9f859eeced9fd0f58173df5d208 (patch)
tree1df0e0bac88c5ec8448110846a75ceeb90c0338b /remote
parentMerge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff)
downloadtm-scripts-ebb08909c987e9f859eeced9fd0f58173df5d208.tar.gz
tm-scripts-ebb08909c987e9f859eeced9fd0f58173df5d208.tar.xz
tm-scripts-ebb08909c987e9f859eeced9fd0f58173df5d208.zip
[cleanup.inc] added traps for SIGINT and SIGTERM
Upon SIGINT and SIGTERM, cleanexit is called. At the moment, checks for mounts done by chroot and tries to umount them. TODO: make the cleanup modular instead of writing the stuff directly inside cleanexit. A-la 'cleanup.d' for example.
Diffstat (limited to 'remote')
-rw-r--r--remote/includes/cleanup.inc29
1 files changed, 29 insertions, 0 deletions
diff --git a/remote/includes/cleanup.inc b/remote/includes/cleanup.inc
new file mode 100644
index 00000000..144d7fd9
--- /dev/null
+++ b/remote/includes/cleanup.inc
@@ -0,0 +1,29 @@
+# -----------------------------------------------------------------------------
+#
+# Copyright (c) 2014 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+#
+# Trapped cleanup functions
+#
+# -----------------------------------------------------------------------------
+
+# run 'cleanexit' when CTRL-c is pressed, an abrupt program termination or exit happens
+trap cleanexit SIGINT SIGTERM
+
+# main cleaner function
+cleanexit() {
+ pinfo "SIGINT/SIGTERM triggered - cleaning up ..."
+ # unmount and remove the temporary chroot stuff
+ chroot_cleanup_mounts
+
+ # TODO vmware etc/vmware/config stuff here, if it is still needed
+
+}