42 lines
885 B
Tcsh
42 lines
885 B
Tcsh
#!/bin/csh
|
|
|
|
## config section
|
|
set ezjail_config_dir = "/usr/local/etc/ezjail"
|
|
set backup_config_dir = "/tank/backup/jails"
|
|
set backup_date = `date "+%Y%m%d%H%M.%S"`
|
|
|
|
# backup all jails
|
|
echo ""
|
|
echo "################ BACKUP JAILS #################"
|
|
foreach jail (`ls /usr/jails | \
|
|
grep -v basejail | \
|
|
grep -v ezjail_archives | \
|
|
grep -v flavours | \
|
|
grep -v newjail | \
|
|
grep -v fulljail`)
|
|
|
|
## stopping jail
|
|
ezjail-admin stop $jail
|
|
|
|
## start backing up jail + jailconfig
|
|
echo "Backup jails: $jail"
|
|
|
|
## backup jail config
|
|
cp $ezjail_config_dir/$jail $backup_config_dir
|
|
mv $backup_config_dir/$jail "$backup_config_dir/$jail-$backup_date.conf"
|
|
|
|
## backup jail content
|
|
ezjail-admin archive $jail
|
|
echo ""
|
|
|
|
## start jail
|
|
ezjail-admin start $jail
|
|
echo ""
|
|
|
|
end
|
|
|
|
# report done
|
|
echo ""
|
|
echo "############### ALL DONE THANKS ###############"
|
|
echo ""
|