Quote:
Originally posted by sprintserve
You can do it without changing the code (and hence no problem with Cpanel rewritting it) by simply chattr +i weekly and monthly backup directories.
|
yep
I did that before, as you suggest in another thread, and it worked well.
But since I wanted to edit it to send me an E-Mail after the backup was done (because I prefer to backup it to SAMBA server manually, typing the password), and I came with the "weekly" and "monthly" thing in my front, I couldn't resist changing it
BTW, as requested on PM, I'll tell the way I changed the code, in case it interests to someone else.
I'm afraid to post the whole code here, since it's subject to cpanel license, so I'll say just the changes... (BACKUP BEFORE!)
where you have:
Quote:
|
if ($CONF{'BACKUPINT'} eq "daily")
|
go 11 lines down and you will see:
Quote:
|
if (! -e "${basedir}/weekly" || isolderthen(6,"${basedir}/weekly"))
|
start commenting there (put a "#" [no quotes] in the start) and comment 15 more lines (you should have 16 "#")
after you do that, type:
Quote:
root@server01 [~]# perl -c /scripts/cpbackup
/scripts/cpbackup syntax OK
|
and hope to see syntax OK... if you don't see it, check if you commented the correct lines.
if you want to get an E-Mail after backup is complete, search for
BEFORE that, add:
Quote:
open(MAIL,"|/usr/sbin/sendmail -t");
print MAIL "To: root\n";
print MAIL "From: cPanel BACKUP <noreply\@noreply.com>\n";
print MAIL "Subject: Backup Complete\n\n";
print MAIL "The backup is complete";
close(MAIL);
|
a few notes about this code:
1) you may need to change "/usr/sbin/sendmail" to your current sendmail location, although I guess this one will work for almost all RH distributions
If you're not sure where your sendmail is located, type:
Quote:
root@server01 [~]# whereis sendmail
sendmail: /usr/sbin/sendmail /usr/lib/sendmail
|
2) If you want to change the "To" field to some other E-Mail, don't use "@", use "\@" (like is being done at the "From" field)...
example:
Quote:
|
print MAIL "To: name\@isp.com\n";
|