Automatic Snipe-IT Backups

The below crontab runs at 0600 and 0605. You will also need to make sure the user which the cron is running under is in the apache group.

Also make sure the file permissions are correct, they will probably be 755, they need to be 775 for users in the apache group to write to them.

sudo chmod 775 storage/app/backup-temp/ -R
sudo chmod 775 storage/app/backups/ -R

Run crontab -e (DON’T SUDO) and paste the below in, changing as required for your setup. Mine was copying to a windows share mounted at /folder/backup

The below commands to copy the zip file need refinement, I was rushing when this was written but will return to add some more logic e.g. copy files of a certain age/don’t copy if it’s a duplicate.

0 6 * * * /usr/bin/php /var/www/snipe-it/artisan snipeit:backup
5 6 * * * /usr/bin/cp /var/www/snipe-it/storage/app/backups/*.zip /folder/backup/

Setup your fstab by adding a line similar to below, make changes relevant to your environment.

//server/share /home/user/backup cifs username=mswindowsuser,password=mspassword,nounix,iocharset=utf8,user,sec=ntlmssp,uid=userid,gid=groupid 0 0

Leave a Reply

Your email address will not be published. Required fields are marked *