Dismiss Notice
We would like to remind you that we’re updating our login process for all 3CX forums whereby you will be able to login with the same credentials you use for the Partner or Customer Portal. Click here to read more.

Automatically Schedule your 3CX Backup

Discussion in '3CX Phone System - General' started by ziptalk, Aug 17, 2009.

Thread Status:
Not open for further replies.
  1. ziptalk

    ziptalk New Member

    Joined:
    Nov 16, 2008
    Messages:
    180
    Likes Received:
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. WINWARE

    Joined:
    Nov 30, 2007
    Messages:
    29
    Likes Received:
    0
    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
     
  3. WINWARE

    Joined:
    Nov 30, 2007
    Messages:
    29
    Likes Received:
    0
    Also, Does this stop the 3cx services to do the backup?
     
  4. ziptalk

    ziptalk New Member

    Joined:
    Nov 16, 2008
    Messages:
    180
    Likes Received:
    0
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. tpinnovations

    tpinnovations Member

    Joined:
    Jul 30, 2009
    Messages:
    296
    Likes Received:
    0
    Correct me if I'm wrong, But don't you need to make sure you have volume shadow copy enabled to prevent file corruption?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. johnb

    Joined:
    Sep 21, 2009
    Messages:
    1
    Likes Received:
    0
    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.
     
  7. pjr

    pjr New Member

    Joined:
    Oct 5, 2009
    Messages:
    154
    Likes Received:
    0
    Hi John - thanks for that - works like a charm!

    Paul
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. LeonidasG

    LeonidasG Support Team
    Staff Member 3CX Support

    Joined:
    Nov 19, 2008
    Messages:
    1,557
    Likes Received:
    118
    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.
     

    Attached Files:

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. stash

    stash New Member

    Joined:
    Feb 23, 2012
    Messages:
    213
    Likes Received:
    0
    Sir john,


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


    Thanks,

    STASH
     
  10. gschwab

    gschwab New Member

    Joined:
    Mar 21, 2012
    Messages:
    131
    Likes Received:
    0
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. craigreilly

    craigreilly Well-Known Member

    Joined:
    Feb 1, 2012
    Messages:
    3,530
    Likes Received:
    298
    Add a USB drive so at least it's on a separate medium...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. igadmin

    Joined:
    Jun 19, 2012
    Messages:
    1
    Likes Received:
    0
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. craigreilly

    craigreilly Well-Known Member

    Joined:
    Feb 1, 2012
    Messages:
    3,530
    Likes Received:
    298
    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"
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. grapevine

    Joined:
    Nov 4, 2011
    Messages:
    2
    Likes Received:
    0
    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.
     
  15. craigreilly

    craigreilly Well-Known Member

    Joined:
    Feb 1, 2012
    Messages:
    3,530
    Likes Received:
    298
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. PCTurnkey

    Joined:
    Mar 26, 2012
    Messages:
    31
    Likes Received:
    0
    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!
     
  17. PCTurnkey

    Joined:
    Mar 26, 2012
    Messages:
    31
    Likes Received:
    0
    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).
     
  18. Denzeltpa

    Joined:
    May 3, 2012
    Messages:
    4
    Likes Received:
    0
    @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.
     
Thread Status:
Not open for further replies.