util-vserver (1440B)
1 #!/sbin/runscript 2 # Copyright 1999-2007 Gentoo Foundation 3 # Distributed under the terms of the GNU General Public License v2 4 5 start() { 6 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} 7 if [ ! -e ${UTIL_VSERVER_VARS} ]; then 8 eerror "Cannot find util-vserver installation" 9 eerror "(the file '$UTIL_VSERVER_VARS' would be expected)" 10 return 1 11 fi 12 13 . ${UTIL_VSERVER_VARS} 14 15 ebegin "Creating directories for $PACKAGE_NAME" 16 $_BASH_WRAPPER 'create_dirs' 17 eend $? 18 19 ebegin "Setting vshelper path to $_VSHELPER" 20 $_BASH_WRAPPER 'set_helper' 21 eend $? 22 23 ebegin "Loading default device map" 24 $_BASH_WRAPPER 'handleDeviceMap --set 0 "$__CONFDIR/.defaults/apps/vdevmap"' 25 eend $? 26 27 $_BASH_WRAPPER 'hasCgroup' 28 if [ $? -eq 0 ]; then 29 ebegin "Mounting cgroup-hierarchy" 30 $_BASH_WRAPPER 'mount_cgroup' 31 eend $? 32 fi 33 } 34 35 stop() { 36 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} 37 if [ ! -e ${UTIL_VSERVER_VARS} ]; then 38 eerror "Cannot find util-vserver installation" 39 eerror "(the file '$UTIL_VSERVER_VARS' would be expected)" 40 return 1 41 fi 42 43 . ${UTIL_VSERVER_VARS} 44 45 ebegin "Stopping all running guests" 46 $_START_VSERVERS -j 1 --all --stop 47 eend $? 48 49 ebegin "Killing all running contexts" 50 $_BASH_WRAPPER 'kill_contexts' 51 eend $? 52 53 $_BASH_WRAPPER 'hasCgroup' 54 if [ $? -eq 0 ]; then 55 ebegin "Unmounting cgroup-hierarchy" 56 $_BASH_WRAPPER 'umount_cgroup' 57 eend $? 58 fi 59 } 60 61 # vim:ts=4:filetype=gentoo-init-d