Exercise: save-delete-restore

To clarify things it might be interesting to see how components, data sources and profiles are saved, deleted and restored:

 
Collect the information (a cron job stores the files below /online_dir/nexusSaves)
  $ nxsconfig list > components.lis
  $ nxsconfig list -d > datasoures.lis
  $ nxsconfig list -r > profiles.lis
  $ nxsconfig list -m > mandatory.lis
    these lists will later be used to restore things

  $ nxsconfig list | nxsconfig show  -o /online_dir/nexusSaves/dir_00001
    the components
  $ nxsconfig list -d | nxsconfig show -d -o /online_dir/nexusSaves/dir_00001
    the data source
  $ nxsconfig list -r | nxsconfig show -r -o /online_dir/nexusSaves/dir_00001
    profiles, json files
      profiles contains selected components and selected data sources
      which may not be in components

Delete everything
  $ nxsconfig list | nxsconfig delete -f
    removes all components
  $ nxsconfig list -d | nxsconfig delete -d -f
    removes all data sources
  $ nxsconfig list -r | nxsconfig delete -r -f
    removes profiles

Restore things
  cat components.lis | nxsconfig upload 
    Restore components
  cat mandatory.lis | nxsconfig upload -m -f 
    Restore mandatory components
  cat datasources.lis | nxsconfig upload -d 
    Restore data sources
  cat profiles.lis | nxsconfig upload -r 
    Restore profiles

After the procedure described above has been executed all components should have their data sources. However, this is the procedure how to detect inconsistencies and how to repair them.

 
$ nxscreate onlineds > /dev/null 
Info: Inconsistent components is the NeXus database - default, defaultinstrument, defaultsample, pilatus, source

fix default, see whether default depends on another data source
$ nxsconfig get default
Error: Datasource end_time not stored in Configuration Server

So, upload end_time data source
$ nxsconfig upload -d end_time

And again: 
$ nxscreate onlineds > /dev/null 
Info: Inconsistent components is the NeXus database - default, defaultinstrument, defaultsample, pilatus, source

$ nxsconfig get default
Error: Datasource nexdatas_version not stored in Configuration Server
$ nxsconfig upload -d nexdatas_version
likewise: 
  $ nxsconfig upload -d nexdatas_configuration
  $ nxsconfig upload -d title
  $ nxsconfig upload -d sample_name
  $ nxsconfig upload -d chemical_formula
likewise for other components displayed by 'nxscreate onlineds > /dev/null'



2020-05-12