Tryag File Manager
Home
-
Turbo Force
Current Path :
/
etc
/
init.d
/
Upload File :
New :
File
Dir
//etc/init.d/jail
#!/bin/bash # # jailtool Start/Stop the jails # # chkconfig: 2345 50 65 # description: This script does nothing on start and cleans out # jails on stop with a force command. # # Source function library. . /etc/init.d/functions # Where dead jails to to rest... REMOVAL='/chroot/removal' # define a function that removes directories # which are no longer mounted but still exist. This # can happen during a reboot. remove_dirs() { local delete_file for delete_file in `ls $REMOVAL | grep -E '^[0-9]+-stale-[0-9]+.[0-9]+'` do if [ -z "`grep $delete_file /proc/mounts`" ] then # Just in case someone has linked a directory. # Don't delete any sym links here. if [ ! -L "$REMOVAL/$delete_file" ] then # Since the above is not mounted, it is # safe to delete it. rm -fr "$REMOVAL/$delete_file" fi fi done } case "$1" in start) echo $"Tearing down any stale jails." /usr/libexec/jailtool clean force # remove any existing stale directories now, but # first ensure we're not mounted. remove_dirs # A standard purge, now that any remaining # junk has been cleaned up. /usr/libexec/jailtool purge /usr/libexec/jailtool purgelocks touch /var/lock/subsys/jail exit 0 ;; stop) echo $"Tearing down jails." /usr/libexec/jailtool clean force /usr/libexec/jailtool purge /usr/libexec/jailtool purgelocks rm -f /var/lock/subsys/jail ;; *) echo $"Usage: $0 {start|stop}" RETVAL=1 esac