[Linux] How to do a CLI backup/restore of the gateway

I’m wondering if it is possible to do a backup of the gateway from the CLI on a Linux OS. Also if this is possible how could I do a restore afterwards?
If it is in the manuals please point me in the right direction because I have not been able to find it so far.


Yes, it’s possible to do Gateway backups and restorations from the command line. You run a command called gwcmd with the following options:

gwcmd --backup <path to download .gwbk> gwcmd --restore <path to .gwbk>
You can also run gwcmd by itself to get all the command like options and info.

When I try that it gives me the following output:

./gwcmd.sh --backup /home/sbart/test.gwbk Exception in thread "main" java.lang.NoClassDefFoundError: com.inductiveautomation.catapult.control.HeadlessControlUtil at gnu.java.lang.MainThread.run(libgcj.so.7rh) Caused by: java.lang.ClassNotFoundException: com.inductiveautomation.catapult.control.HeadlessControlUtil not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}} at java.net.URLClassLoader.findClass(libgcj.so.7rh) at java.lang.ClassLoader.loadClass(libgcj.so.7rh) at java.lang.ClassLoader.loadClass(libgcj.so.7rh) at gnu.java.lang.MainThread.run(libgcj.so.7rh) /local/apollo/package/local_1/Linux-2.6c2.5-x86_64/FCControls_Ignition/FCControls_Ignition-40.0-0/Ignition

Which version of Java is this? Currently, we only support Oracle Java and OpenJDK 7 on Linux. Also, I have since learned that the restore feature is coming in 7.7, so only the backup portion is available right now.


java version “1.7.0_45”
Java™ SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot™ 64-Bit Server VM (build 24.45-b08, mixed mode)

I would recommend installing Oracle Java 7. Then gwcmd should definitely work. If you know for sure that you have Oracle Java 7, then something else is going on, like the wrong Java is in the system path or something like that.

From the gateway screen:

Version 7.6.4 (b2013112117)
Java Version Oracle Corporation 1.7.0_51

So it is Oracle Java.

The gateway itself is working properly just the command line backup.

I know this is a really old issue that was reported. There were a number of tickets where it seemed doing gateway backups from the command line was not working correctly. I did find that this issue was resolved for 7.7.3, FWIW

Hi, I’m also trying to do a backup of the gateway from the CLI on a Linux OS but in my case the error is diferent:

gwcmd --backup /home/ignition/backups/
Error! Error! Could not move /var/lib/ignition/temp/gatewayBackupTEMP911672483228459577.gwbk to /home/ignition/backups/Ignition-backup-20150528-1533.gwbk

As you can see the file has been generated but it has not been possible to move it to another folder. However, if I move the file manually it works. Someone can tell me what could be the problem?

Thanks in advance.

It sounds like the OS is not letting you delete the old file during the move, as the error looks to be coming from the OS. Which Linux OS is this? Also, how are you running gwcmd? Via a script in a cron task?

The OS is CentOS release 6.4 (Final)

Currently I’m doing test using the console, but the goal is to execute it via script in a cron task.

This is right from the manual, just not sure if you seen it.

[code]Scheduled Backups
These 4 properties (enable, backup folder, backup times, and retention count) control the Gateway’s scheduled backup system. This system is capable of automatically making a Gateway backup and storing it to a folder path, which may be a network path. When you enable this system, you must specify a destination folder. This may be a local folder, for example “C:\backups” or “/var/backups” or a network path such as “\fileserver\backups”.

The scheduled backup system works on a schedule that is specified using UNIX crontab syntax. This is a standard format for specifying a basic schedule. The format consists of five space-separated fields, one for minute, hour, day-of-month, month, and day-of-week. The special character * means “all”. Slashes can be used to indicate that values should be stepped, for example, */5 in the minutes field means “every 5 minutes”, or 0:00, 0;05, 0:10, etc. Some examples:
5 * * * *
Once an hour, on the :05 minute. 0:05, 1:05, 2:05, etc.
*/15 * * * *
Every 15 minutes, on the quarter-hour. 0:15, 0:30, 0:45; 1:00, 1:15, etc.
30 5 * * Mon
Every Monday at 5:30am

  • 6-14 * * *
    Every minute, but only between 6am and 2pm
    */5 8-17 * * 1-5
    Every 5 minutes between 8am and 5pm but only during the week (1-5). 0=Sunday, 1=Monday, etc.
    0 1 5 * *
    Once a month, on the 5th day at 1am

Thanks Jim but the problem appears when I run the command on the console:

On the other hand, I tried to execute the command via script in a cron task

but show me a different error:

/home/ignition/scripts/launch-backup-ignition.sh: line 2: gwcmd: command not found

Any hints on what I’m doing wrong? The version of Ignition is 7.6.4


Looking at the first error message I would say it is a permission issue to write to that folder, but it looks like you are “root”.

Just a guess here but generally in a cron script you have to supply a complete path to each executable you want to run. Reason being that the cron task does not create the same env that you as a logged in user has.

eg: gwcmd … should be /home/ignition/bin/gwcmd …

Thanks Robert for the input. The second problem has been fixed but not the first. Does anyone know if there is a known issue with the version 7.6.4 related to “gwcmd” command?

What user owns the folder where you are trying to place the backup? If you created that subfolder with root, and the gwcmd is switching to the ignition user (which it must for various operations), then it won’t be able to reach that folder. Also true for your crontab. Consider using “su - ignition” to take the ignition identity before manipulating ignition’s files and folders. Also lets you conveniently access ignition’s own crontab.

ok pturmel, now works. Thanks for the help guys.