[FreeBSD] Added jail backup and update scripts
This commit is contained in:
parent
b8e9316b07
commit
7821a9980e
41
FreeBSD/jail-backup.csh
Normal file
41
FreeBSD/jail-backup.csh
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/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 ""
|
32
FreeBSD/jail-update.csh
Normal file
32
FreeBSD/jail-update.csh
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/csh
|
||||||
|
|
||||||
|
# Upgrade host packages
|
||||||
|
echo ""
|
||||||
|
echo "############ UPGRADE HOST PACKAGES ############"
|
||||||
|
echo ""
|
||||||
|
pkg update && \
|
||||||
|
pkg upgrade -y && \
|
||||||
|
pkg clean -ya
|
||||||
|
|
||||||
|
# Upgrade jail packages
|
||||||
|
echo ""
|
||||||
|
echo "############ UPGRADE JAIL PACKAGES ############"
|
||||||
|
foreach jail (`ls /usr/jails | \
|
||||||
|
grep -v basejail | \
|
||||||
|
grep -v ezjail_archives | \
|
||||||
|
grep -v flavours | \
|
||||||
|
grep -v newjail | \
|
||||||
|
grep -v fulljail`)
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Updating $jail"
|
||||||
|
pkg -j $jail update && \
|
||||||
|
pkg -j $jail upgrade -y && \
|
||||||
|
pkg -j $jail clean -ay
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# Report done
|
||||||
|
echo ""
|
||||||
|
echo "############### ALL DONE THANKS ###############"
|
||||||
|
echo ""
|
Loading…
Reference in New Issue
Block a user