使用 clonezilla 自动备份,更改目录名称

问题描述

我按照 this 教程使用 clonezila 自动备份我的系统。 所以我的 /etc/grub.d/40_custom 看起来像这样:

menuentry "Clonezilla Live 2.3.1-18 (Unattended Backup)" {
set isofile="/isos/clonezilla-live-2.3.1-18-amd64.iso"
loopback loop (hd0,1)$isofile
linux (loop)/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset ocs_prerun=\"mount /dev/sdb1 /mnt\" ocs_prerun1=\"mount --bind /mnt/backup /home/partimag/\" ocs_live_run=\"ocs-sr -q2 --batch -j2 -z1p -i 2000 -sc -p reboot savedisk autoproductname sda\" ocs_live_extra_param=\"\" keyboard-layouts=\"\" ocs_live_batch=\"yes\" locales=\"\" vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img
}

备份创建在一个名为 ___-img (/mnt/backup/___-img/文件夹中。如何更改上面的代码,以便备份存储在包含备份实际日期的文件夹中?例如 { {1}}。

编辑:我尝试过类似的方法,但路径 2021-01-02-img 仍然相同 - 我认为这会创建类似 /mnt/backup/___-img/内容

/mnt/backup/2021-01-02/___-img/

但就像我说的,我需要 menuentry "Clonezilla Live 2.3.1-18 (Unattended Backup)" { set isofile="/isos/clonezilla-live-2.3.1-18-amd64.iso" backupdate=$(date '+%Y-%m-%d') loopback loop (hd0,1)$isofile linux (loop)/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset ocs_prerun=\"mount /dev/sdb1 /mnt\" ocs_prerun1=\"mount --bind /mnt/backup/$backupdate /home/partimag/\" ocs_live_run=\"ocs-sr -q2 --batch -j2 -z1p -i 2000 -sc -p reboot savedisk autoproductname sda\" ocs_live_extra_param=\"\" keyboard-layouts=\"\" ocs_live_batch=\"yes\" locales=\"\" vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile initrd (loop)/live/initrd.img }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)