Automatically Schedule your 3CX Backup

Status
Not open for further replies.

ziptalk

Joined
Nov 16, 2008
Messages
177
Reaction score
0
Here is a short batch file script you can schedule using Task Scheduler to backup your 3CX using the 3CX Backup Utility. This script will generate a new backup file eachtime it is run, by virtue of the %random% value that ensures the file name is unique. Note, the random function is basic, but it'll suffice for my requirements, and that is daily snapshot backups, particularly as I am editing the configuration on a regularly basis as I learn more about the system and implement features and soforth.

Backup.bat - Sample Code for automated scheduled backups to generate unique filename and not overwrite existing backup
Code:
cd C:\Program Files\3CX PhoneSystem\Bin

3CXBackup backup C:\3CX_Backup\3cxbackup%random%.zip /call history /prompts /recordings /exit

I would dump some more screenshots in, but it's late, and I trust everyone is accustomed to setting up a task in task scheduler and creating a .bat file in notepad.

Hope that's useful. Lewis
 
What version of 3CX backup are you using? I am using v7.1.6589.0.

When I run a 3CXBackup.exe /? I get the switches are:

/callrecordings
/voicemails
/voicepromts
/callhist
 
Also, Does this stop the 3cx services to do the backup?
 
WINWARE said:
Also, Does this stop the 3cx services to do the backup?
doesn't stop the services, it's a live backup, i have one running mid-day and no issues on the phone system which is live.

I'm running 7.1.7139.0

If you check the manual it shows all the switches, I think I saw the /exit there to close the gui on completion.

Hope that helps, Lewis
 
Correct me if I'm wrong, But don't you need to make sure you have volume shadow copy enabled to prevent file corruption?
 
Apparently the option switches have changed. I use the following:

REM set todays date as variable - NOTE this only works for UK dates - change for other date layouts

SET TODAY=%date:~6,4%-%date:~3,2%-%date:~0,2%

"c:\program files\3cx phonesystem\bin\3cxbackup.exe" /hidden backup Z:\3cx_backups\%today%.zip /callrecordings /voicemails /voiceprompts /callhis


This runs backup hidden and automaticaly exits on completion. Each filename is date of backup.
 
Hi John - thanks for that - works like a charm!

Paul
 
Here's my Working solution for it.
And it's Fully Automated.


You can Change the Program Files Path if you are using 64Bit / 32Bit Machines.
You will have to make a Folder Called 3CXBackups in your C:\ Directory first so all the backups will go there.
 

Attachments

Sir john,


How can i include the firmware on the backup :D and changed the %today% filename to be the date todya?


Thanks,

STASH
 
Lets not forget that in the event of a hard drive failure (your most likely reason for data loss) these backups are useless if stored on the same drive as 3CX. At the very least you should make a backup of your working installation to a CD or DVD. I personally do a tape backup of the server every night and take the previous nights backup off premises that way should there be a failure or worse yet a theft or fire I simply get a new computer, restore the whole thing and be up and running.

George
 
Add a USB drive so at least it's on a separate medium...
 
You can also create a "Dated" backup instead of a randomized named backup.

I'm using this script which gives me backup files with <today's date>.zip

@echo off
cd "C:\Program Files\3CX PhoneSystem\Bin\"
set today=%date:~-4%%date:~4,2%%date:~7,2%
3CXBackup.exe backup C:\3CXBackup\3CX.%today%.zip /callrecordings /voicemails /voiceprompts /callhist /firmware /exit
SET today=
exit
 
and you can use the forfile utility to get rid of "x" # of files.
I keep 5 days
forfiles.exe /p F:\ /s /m *.zip /d -5 /c "cmd /c del @path"
 
I have been trying to get the automatic back-up to work on version 11 and have now sorted it...with help.

I am running this on Windows 7 Pro (64-bit).

> Use the following to create a batch file:

@echo off
echo Running Configuration Backup...
"C:\Program Files\3CX PhoneSystem\Bin\3CXBackup.exe" hidden backup "(Specify the path here that you want to save to)\config_backup.zip" /exit

echo Running Data Backup...
"C:\Program Files\3CX PhoneSystem\Bin\3CXBackup.exe" hidden backup "(Specify the path here that you want to save to)\full_backup.zip" /callrecordings /voicemails /voiceprompts /callhist /exit

> Save that file to the C:\ drive
> Give administrator rights to the 3CX Backup and Restore Utility
> Open Windows Task Scheduler
> Create a new file by right clicking on the Task Scheduler Library and name it 3CX
> Create a new task in here and use the batch file that you saved to the C:\ drive.
> Set the task to run as often or as little as required.

This will now create a full backup (VM ect..) and a config backup which is your base config.

Hope this helps as I had to spend a bit of time on it getting it right.
 
You should also consider backing up to a Thumb Drive or external hard drive if you are on a small machine (non server grade [no raid]).
Also, I recently had some issue getting the backup to run when not logged in, and I found changing the user to "Administrators" (the group) that it worked.
 
Thanks guys. The BackerUpper didn't work for me, but used the first post to create a .bat file. Changed it so it backed-up on server and locally.
Works like a charm!
 
Here's what I used (created in notepad, filename: 3cxBackup-Local.bat):

cd C:\Program Files\3CX PhoneSystem\Bin

3CXBackup backup E:\Backup\3CX\3cxbackup%random%.zip /call history /callrecordings /voicemails /voiceprompts /callhist /prompts /recordings /exit


#I think the last two are redundant, but I checked the zip file it created and it has everything I needed stored. File size is about 5.80MB (don't know if that's really low since my setup is relatively new, or average for 10 extensions).
 
grapevine said:
I have been trying to get the automatic back-up to work on version 11 and have now sorted it...with help.

This will now create a full backup (VM ect..) and a config backup which is your base config.

Hope this helps as I had to spend a bit of time on it getting it right.

@Grapevine, Thanks it worked great. Does the full backup include the full system config? I haven't gotten into the manual to really check how it runs and with what switches.

Also, I put the backup into a mapped network drive and into dropbox. I always have an offsite copy.
 
Status
Not open for further replies.

Members Online Now

Forum statistics

Threads
111,843
Messages
589,328
Members
164,680
Latest member
JV J