FreeBSD定期创建快照

1、安装sysutils/freebsd-snapshot

portmaster sysutils/freebsd-snapshot

2、配置cron

sudo crontab -e

添加

# /etc/crontab
0 * * * * root /usr/local/sbin/periodic-snapshot hourly
0 0 * * * root /usr/local/sbin/periodic-snapshot daily
0 0 * * 0 root /usr/local/sbin/periodic-snapshot weekly

编辑/etc/periodic.conf

sudo vim /etc/periodic.conf

添加

snapshot_enable="YES"
snapshot_schedule="/home:2:10:0"

上述snapshot_schedule变量值必须符合以下语法:

<schedule>
::= <entry>*
<entry>
::= <fs> (", <fs>)* : <spec>
<fs>
::= /^.*$/
<spec>
::= <gen_weekly> : <gen_daily> : <gen_hourly> <gen_weekly> 
::= <generation>
<gen_daily>
::= <generation> <gen_hourly> 
::= <generation> ("@ <hour> (", <hour>)*)? <generation> 
::= /^[0-9]+$/
<hour>
::= /^(0?[0-9]|1[0-9]|2[0-3])$/

回复

This site uses Akismet to reduce spam. Learn how your comment data is processed.