Hacks:Engine:Backups not working

From VHCP Support

Jump to: navigation, search

First Case

Notes: If you are using the debian packages from http://apt.scunc.it/ then don't make the next changes.

By default, 2.4.7.1 has

/var/www/webadmin/engine/backup/vhcp-backup-all yes &>/var/log/vhcp/vhcp-backup-all-mngr.log

in crontab. That can be fixed by changing:

/var/www/vhcp/engine/tools/vhcp-backup-all yes &>/var/log/vhcp/vhcp-backup-all-mngr.log

Also, change /etc/vhcp/crontab/working/crontab.conf

/var/www/vhcp/engine/tools/vhcp-backup-all yes &>/var/log/vhcp/vhcp-backup-all-mngr.log

Path to vhcp-backup-all is wrong, it should be tools and not backup. This is maybe caused from a typo in engine/Makefile during setup:

$(CMD_INSTALL) ./backup/vhcp-bk-task $(SYSTEM_ENGINE_ROOT)/backup
$(CMD_INSTALL) ./backup/vhcp-backup-all $(SYSTEM_ENGINE_ROOT)/tools

Second Case

Also, if a user deletes it's backups/ directory the VHCP backups engine will stop working by aborting and then leaving the lock file, preventing the backups engine from working. When reading the report of the cronjob it will look like this:

Use of uninitialized value in concatenation (.) or string at /var/www/webadmin/engine/backup/../vhcp_common_code.pl line 755.
Use of uninitialized value in concatenation (.) or string at /var/www/webadmin/engine/backup/../vhcp_common_code.pl line 755.
Use of uninitialized value in concatenation (.) or string at /var/www/webadmin/engine/backup/../vhcp_common_code.pl line 755.
ERROR: Undefined input data, dname: |/var/www/virtual/domain.tld/backups|, duid: ||, dgid: ||, dperms: || !

To fix this problem open /var/www/webadmin/engine/backup/vhcp-backup-all, and search for:

                        if(! -d $dmn_backup_dir)
                        {
                                $rs = make_dir($dmn_backup_dir);

                                return $rs if ($rs != 0);

                                $rs = setfmode($dmn_backup_dir, "root", "root", 0644);

                                return $rs if ($rs != 0);
                        }

and replace it with:

			if(! -d $dmn_backup_dir)
			{
				#$rs = make_dir($dmn_backup_dir);
				$rs = make_dir($dmn_backup_dir, $domain_uid, $httpd_gid, 0770);
			
				return $rs if ($rs != 0);		

				#$rs = setfmode($dmn_backup_dir, "root", "root", 0644);
			
				#return $rs if ($rs != 0);
			}

That will fix an error on the backups engine which tries to create the backups directory if it doesn't exists. Now just delete the lock file which is usually located at /tmp/vhcp-backup-all.lock and let the cronjob run, or manually run it by using:

/var/www/webadmin/engine/backup/vhcp-backup-all yes
Personal tools