CLI Backup

Started by guest15389, January 29, 2018, 04:44:41 PM

Previous topic - Next topic
I was using this:

https://forum.opnsense.org/index.php?topic=4690.msg18194#msg18194

I'm not sure if something changed with my Linux box as I made a move from Debian to Fedora, but I just noticed I'm getting an error when using your script:

/home/felix/scripts/router/opn_backup.rb:42:in `<main>': undefined method `scan' for nil:NilClass (NoMethodError)

Does it need an update or am I just missing something that needs to be installed?

ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]

This is not an issue with your box - it seems like the XSRF protection has changed and the script was not aware of it - I updated the script so it should work again but it will need an XML parser (nokogiri) to work.

You can install this dependency using gem install nokogiri. It might be in your package manager as well because it is a very common package.

I was able to get that installed but still generates the same error.

[felix@plex router]$ gem install nokogiri
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.8.2
Parsing documentation for nokogiri-1.8.2
Installing ri documentation for nokogiri-1.8.2
Done installing documentation for nokogiri after 7 seconds
1 gem installed
[felix@plex router]$ ls
ppn_backup  opn_backup.rb
[felix@plex router]$ ./opn_backup
/home/felix/scripts/router/opn_backup.rb:42:in `<main>': undefined method `scan' for nil:NilClass (NoMethodError)

did you download the new version of the script?

I did, but didn't update my main script to use the new one. Fixed and working now.

Thanks!