Import/Export Config Trees
This topic summarizes how to create a script to automate importing and exporting config tree settings.
Legato automatically creates copies of config trees during updating.
An import/export script is an easy way to create a copy of your config trees in case you want to reinstate without rebuilding them.
This code sample shows how you can wrap update
in a shell script that will automate the import/export functions:
#!/bin/bashAPP_NAME=$1if [ -z "$APP_NAME" ]then>&2 echo "Application name not specified."exit 1fiif [ -z "$2" ]thenif [ -z "$DEST_IP" ]then>&2 echo "Device IP address not specified."exit 1fiDEVICE_IP=$DEST_IPelseDEVICE_IP=$2fifunction cfg{CMD=$1#echo "Test: "ssh root@$DEVICE_IP "/usr/local/bin/config $CMD $APP_NAME:/ ~/$APP_NAME.cfg"}cfg exportupdate $APP_NAME.wp85.update $DEVICE_IPcfg import
If you save this script as inst.sh
, you can run like this:
$ inst.sh <myApp> <myDeviceIP>
or
$ export DEST_IP=<myDeviceIP>$ inst.sh myApp
Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.