tachtler / dovecot-backup

Dovecot backup shell script for saving emails for every mailbox to its own tar.gz file.
GNU General Public License v3.0
55 stars 20 forks source link

OpenBSD issues #27

Open ozgurkazancci opened 4 hours ago

ozgurkazancci commented 4 hours ago

Hello, first of all, thanks for such a useful script.

My mailserver is running on OpenBSD and the script produces the following lines;

+-----------------------------------------------------------------+
| Start backup of the mailboxes [Fri, 20 Sep 2024 15:22:47 (+0300)] |
+-----------------------------------------------------------------+
SCRIPT_NAME.................: dovecot_backup
OS_TYPE.....................: openbsd7.5
COMPRESSION.................: gz
TMP_FOLDER..................: /var/tmp
DIR_BACKUP..................: /root/backup
MAIL_RECIPIENT..............: ozgur@kazancci.com
MAIL_STATUS.................: Y
FILE_USERLIST...............:
FILE_USERLIST_VALIDATE_EMAIL: N
Check if command '/usr/local/bin/dsync' was found .........[ OK ]
Check if command '/bin/tar' was found .....................[ OK ]
Check if command '/usr/bin/touch' was found ...............[ OK ]
Check if command '/bin/rm' was found ......................[ OK ]
Check if command '/bin/cat' was found .....................[ OK ]
Check if command '/bin/date' was found ....................[ OK ]
Check if command '/bin/mkdir' was found ...................[ OK ]
Check if command '/sbin/chown' was found ..................[ OK ]
Check if command '/bin/chmod' was found ...................[ OK ]
Check if command '/usr/bin/grep' was found ................[ OK ]
Check if command '/usr/bin/mktemp' was found ..............[ OK ]
Check if command '/bin/mv' was found ......................[ OK ]
Check if command '/usr/bin/stat' was found ................[ OK ]
Check if command '/usr/sbin/sendmail' was found ...........[ OK ]
Check if command '/usr/bin/gzip' was found ................[ OK ]
Check if the script is NOT already runnig .................[ OK ]
Check if TMP_FOLDER exists ................................[ OK ]
stat: unknown option -- c
usage: stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file ...]
./dovecot_backup.sh: line 449: [: vmail: unary operator expected
Check if TMP_FOLDER owner is vmail ........................[ OK ]
stat: unknown option -- c
usage: stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file ...]
./dovecot_backup.sh: line 463: [: vmail: unary operator expected
Check if TMP_FOLDER group is vmail ........................[ OK ]
Check if DIR_BACKUP exists ................................[ OK ]
stat: unknown option -- c
usage: stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file ...]
./dovecot_backup.sh: line 491: [: vmail: unary operator expected
Check if DIR_BACKUP owner is vmail ........................[ OK ]
stat: unknown option -- c
usage: stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file ...]
./dovecot_backup.sh: line 505: [: vmail: unary operator expected
Check if DIR_BACKUP group is vmail ........................[ OK ]

Check if the variable FILE_USERLIST is set ................[ NO ]
Mailboxes to backup will be determined by doveadm user "*".

Any help on the errors above?

Best.

renaudallard commented 3 hours ago

I guess the script will need to be amended so that the same things used for OSTYPE="FreeBSD" should be used for openbsd***. Besides, $OSTYPE should be replaced by $(uname -s) everywhere to be coherent and easier to manage, so that it doesn't list the OS version, but only the OS name.

renaudallard commented 2 hours ago

Try with this change https://github.com/tachtler/dovecot-backup/commit/94ba03e3fb6d657d6f90956ea377e76c600a81cb

tachtler commented 2 hours ago

Hi,

I will fix that problem with version 1.21.

Greetings Klaus.

ozgurkazancci commented 2 hours ago

Try with this change 94ba03e

Fixed, it seems. Thank you @renaudallard

+-----------------------------------------------------------------+
| Start backup of the mailboxes [Fri, 20 Sep 2024 17:46:24 (+0300)] |
+-----------------------------------------------------------------+

SCRIPT_NAME.................: dovecot_backup

OS_TYPE.....................: OpenBSD

COMPRESSION.................: gz

TMP_FOLDER..................: /var/tmp
DIR_BACKUP..................: /root/backup

MAIL_RECIPIENT..............: ozgur@kazancci.com
MAIL_STATUS.................: Y

FILE_USERLIST...............:
FILE_USERLIST_VALIDATE_EMAIL: N

Check if command '/usr/local/bin/doveadm' was found .......[ OK ]
Check if command '/bin/tar' was found .....................[ OK ]
Check if command '/usr/bin/touch' was found ...............[ OK ]
Check if command '/bin/rm' was found ......................[ OK ]
Check if command '/bin/cat' was found .....................[ OK ]
Check if command '/bin/date' was found ....................[ OK ]
Check if command '/bin/mkdir' was found ...................[ OK ]
Check if command '/sbin/chown' was found ..................[ OK ]
Check if command '/bin/chmod' was found ...................[ OK ]
Check if command '/usr/bin/grep' was found ................[ OK ]
Check if command '/usr/bin/mktemp' was found ..............[ OK ]
Check if command '/bin/mv' was found ......................[ OK ]
Check if command '/usr/bin/stat' was found ................[ OK ]
Check if command '/usr/sbin/sendmail' was found ...........[ OK ]
Check if command '/usr/bin/gzip' was found ................[ OK ]
Check if the script is NOT already runnig .................[ OK ]
Check if TMP_FOLDER exists ................................[ OK ]
Check if TMP_FOLDER owner is vmail ........................[ OK ]
Check if TMP_FOLDER group is vmail ........................[ OK ]
Check if DIR_BACKUP exists ................................[ OK ]
Check if DIR_BACKUP owner is vmail ........................[ OK ]
Check if DIR_BACKUP group is vmail ........................[ OK ]

Check if the variable FILE_USERLIST is set ................[ NO ]
Mailboxes to backup will be determined by doveadm user "*".

+-----------------------------------------------------------------+
| Run backup dovecot_backup ..................................... |
+-----------------------------------------------------------------+

Create temporary '/var/tmp/dovecot_backup-PzUkArIAP0tD' folder [ OK ]

Set ownership of DIR_TEMP to vmail:vmail ..................[ OK ]

Start backup process for user: ...
tachtler commented 2 hours ago

Update dovecot_backup.sh to version 1.21 Fix OpenBSD compatibility!