The pfSense Store

Author Topic: backup / restore config.xml on the command line  (Read 2885 times)

0 Members and 1 Guest are viewing this topic.

Offline ren22

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-1
    • View Profile
backup / restore config.xml on the command line
« on: September 29, 2015, 07:58:18 am »
Hi,

is there any command to backup or restore the config.xml on the command line?
I mean if i only want the config.xml and the not the package configuration as example.

thanks

Offline jimp

  • Administrator
  • Hero Member
  • *****
  • Posts: 21495
  • Karma: +1458/-26
    • View Profile
Re: backup / restore config.xml on the command line
« Reply #1 on: September 29, 2015, 02:41:58 pm »
There isn't a way to filter out the package info from the command line (well, easily... there probably is with a piped chain of various shell commands)

You can just grab the config.xml from /conf/ and cp/scp/etc it wherever you want. If you want to remove the package settings, just edit out the "<installedpackages> ... </installedpackages>" section of the configuration.
Need help fast? Commercial Support!

Co-Author of pfSense: The Definitive Guide. - Check the Doc Wiki for FAQs.

Do not PM for help!

Offline muswellhillbilly

  • Hero Member
  • *****
  • Posts: 935
  • Karma: +73/-4
    • View Profile
Re: backup / restore config.xml on the command line
« Reply #2 on: September 30, 2015, 02:36:32 am »
I run a cron job to backup my config.xml to a local ftp server. Example below:

#!/bin/sh
cd /conf
cat <<END | ftp 'ftp://login:password@ftp.server.com/backup'
put ./config.xml
END

To restore, just run a manual ftp session to the backup server and pull down the last good config, removing the package info as jimp suggests.