Rabu, 03 Juli 2013

Membuat "Recycle bin" pada Samba4

Kehilangan data saat file yang ada di “sharing data” samba terhapus?, solusinya adalah dengan cara membuat  Recycle bin, agar file yang dihapus tidak langsung hilang tapi akan ada di Recycle bin.

Berikut ini langkah-langkahnya :
1. Tambahkan konfigurasi berikut pada konfigurasi bagian file sharing di berkas smb.conf
        path = /data
        comment = Sharing Data
        read only = no
        browseable = yes
        writeable = yes
        guest ok = yes

        vfs object = recycle
        config file = /usr/local/samba/etc/recycle.conf
        recycle:repository = Recycle Bin
        recycle:keeptree = Yes
        recycle:versions = Yes
2. Buat berkas konfigurasinya :
# vi /usr/local/samba/etc/recycle.conf
name = Recycle Bin
maxsize = 0
exclude = *.tmp|*.temp|*.o|*.obj|~$*|*.~??|*.log|*.trace
excludedir = /tmp|/temp|/cache
noversions = *.doc|*.ppt|*.dat|*.ini|*.xls|*.pdf
3. Setelah selesai silakan restart samba
4. Test dengan menghapus file yang ada pada folder sharing “share”, maka akan muncul folder “Recycle Bin”
Noted : 
Pada link referensi tersebut, jika kita salin tempel konfigurasi “smb.conf ” nya, maka akan muncul error saat samba start :
smbd: Ignoring unknown parameter "config-file"
Kesimpulannya adalah pada samba4 parameter “config-file” tidak ada, yang ada adalah “config file”.

Selasa, 02 Juli 2013

Zimbra 8 - automatic backup & restore via script

Some longer time I announced here my plan to make my mail server failsafe. I went for a rather simple approach, because I use Zimbra 8 Open Source Edition.
Every night a make a backup of the mailboxes on server 1 and import them to server 2.
I wrote two bash scripts. One runs, invoked by a daily cronjob in context of the root user, on the primary mail server and creates a backup of all mailboxes. Which mailboxes should be backed up is defined in a text file (this file is parsed with:while read). The command for backing up and restoring mailboxes is 'zmmailbox'.
Example: zmmailbox -z -m user@domain.com getRestURL "//?fmt=zip" > /home/zmbackup/user@domain.com.zip"
At the end of the script the zipped files are rsynced to the secondary mail server. The rsync runs in the context of another user, which is only allowed to run rsync on the backup mail server and authenticates with a passwordless ssh key.
Then, on the second host, another bash script starts which restores the backups. It starts one hour later than the backup script on the primary host, to make sure that backup and rsync on the primary server have finished.
Example: zmmailbox -z -m user@domain.com postRestURL "//?fmt=zip&resolve=reset"/home/zmrestore/user@domain.com.zip
At the beginning of the first and at the end of the second bash script the zip files are deleted, no to flood my disk with backups.