vhost-stack/bin/vhost-user-jails-reset.sh
Matthew Saunders Brown de4e34d6ba permissions
2021-08-15 12:58:17 -07:00

37 lines
697 B
Bash
Executable File

#!/bin/bash
#
# vhost-stack
# https://git.stack-source.com/msb/vhost-stack
# MIT License Copyright (c) 2021 Matthew Saunders Brown
# load include file
source $(dirname $0)/vhost.sh
# make sure jails dir exists
if [[ ! -e /usr/jails/ ]]; then
echo "/usr/jails does not exist"
exit 1
fi
# check if any jails exist
if [ ! "$(ls -A /usr/jails/)" ]; then
echo "no jails exist"
exit 1
fi
# check for /usr/sbin/jk_update
if [[ ! -x "/usr/sbin/jk_update" ]]; then
echo "/usr/sbin/jk_update does not exist or is not executable"
exit 1
fi
# get list of jails
cd /usr/jails/
jails=(*)
for jail in "${!jails[@]}"
do
jail=${jails[$jail]}
echo /usr/local/bin/user-jail-reset.sh $jail
done