I have been running XigmaNAS (previously NAS4Free, both based on FreeBSD) for some time.
I want to implement better backups using both local cleverly choosen snapshots and replication to a remote XigmaNAS.
It seems to me zfsbud can do all of that.
Not to interfere with the operational NAS I created a virtual one and started playing with the zfsbud script.
This however quickly led to errors: 'date -d '2023-02-15 -0 month' +%Y-%m-01' is not accepted.
FreeBSD 'date' would need -jf '%Y-%m-%d' to convert the date part. For date/time adjustment one should use the date -v option. I only managed to realize adjusting partially: date -v has effect with the current time/date, there however is no effect anymore with a command line specified time/date. Careful reading of the man file revealed -v works on the currect date/time only.
I changed zfsbud.sh 'DATECMD=date' into 'DATECMD="date -jf '%Y-%m-%d'"' which overcame the first error (but ignores the date/time adjustment). With this DATACMD in place however the next error pops up: another -d option that is not covered by the DATACMD substitution. Looking at the zfsbud.sh script I have no clue how to fix this through the DATACMD variable.
Conclusion / Question:
It seems to me the DATECMD is not able to solve the issues for FreeBSD. I think the FreeBSD date command cannot be used at all since it does not support the date/time adjustment for a command line provided date/time. I will try to ask on the FreeBSD forum about this. Does anyone have any other ideas, I would still prefer to use zfsbud.sh
I have been running XigmaNAS (previously NAS4Free, both based on FreeBSD) for some time.
I want to implement better backups using both local cleverly choosen snapshots and replication to a remote XigmaNAS.
It seems to me zfsbud can do all of that.
Not to interfere with the operational NAS I created a virtual one and started playing with the zfsbud script.
This however quickly led to errors: 'date -d '2023-02-15 -0 month' +%Y-%m-01' is not accepted.
FreeBSD 'date' would need -jf '%Y-%m-%d' to convert the date part. For date/time adjustment one should use the date -v option. I only managed to realize adjusting partially: date -v has effect with the current time/date, there however is no effect anymore with a command line specified time/date. Careful reading of the man file revealed -v works on the currect date/time only.
I changed zfsbud.sh 'DATECMD=date' into 'DATECMD="date -jf '%Y-%m-%d'"' which overcame the first error (but ignores the date/time adjustment). With this DATACMD in place however the next error pops up: another -d option that is not covered by the DATACMD substitution. Looking at the zfsbud.sh script I have no clue how to fix this through the DATACMD variable.
Conclusion / Question:
It seems to me the DATECMD is not able to solve the issues for FreeBSD. I think the FreeBSD date command cannot be used at all since it does not support the date/time adjustment for a command line provided date/time. I will try to ask on the FreeBSD forum about this. Does anyone have any other ideas, I would still prefer to use zfsbud.sh