Data backup from command line

Hi,

I’d like to create daily backup from Octopus data, so I’ve crated a .cmd file, that is calling the export from command line with the command showed by Octopus, when using Octopus Manager:
“C:\Program Files\Octopus Deploy\Octopus\Octopus.Migrator.exe” export --instance “OctopusServer” --directory “C:\OctopusBackup\Files” --password "xxx"
When I’m logging in to the server and running the file by double clicking it, it runs as expected, the export is created. Although when I’m trying to run the same .cmd file via Windows Task Scheduler, it logs the following error:
“Octopus Deploy: Migrator version 3.4.3 (3.4.3+Branch.master.Sha.d7c942e497d30cd4e5f47d23bc20fc44dd6e24f3)
Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.”

Not really sure, why this happens and what service should the script run. The script has been ran with an admin user and other parts of the script (cleanup, moving files to backup location) ran fine, only the Octopus part has the error mentioned above.

Regards,
Laszlo

Hi Laszlo,

Thanks for reaching out! In order to run your export command via the command line, you just need to add this to your command to tell it to not run as a service:
--console
As a side note: The migrator doesn’t assume deleted data or renamed items. So if you are continually exporting into the same directory without cleaning it, you can create an export that cannot be imported. We don’t know your exact process, we just wanted to let you know that as we have seen that cause issues.

I hope that helps!

Kenny

Hi Kenneth,

Thanks for your help.
About your side note: of course we always doing a clean export, the first step of the process is to purge the export directory. Anyway thanks for your note on that.

Regards,
Laszlo