diff options
author | Jonathan Bauer | 2014-03-11 17:01:11 +0100 |
---|---|---|
committer | Jonathan Bauer | 2014-03-11 17:01:11 +0100 |
commit | ebb08909c987e9f859eeced9fd0f58173df5d208 (patch) | |
tree | 1df0e0bac88c5ec8448110846a75ceeb90c0338b /remote | |
parent | Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff) | |
download | tm-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.inc | 29 |
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 + +} |