Personal tools

Difference between revisions of "Scripts usage"

From PhotoVoltaic Logger new generation

Jump to: navigation, search
m
m (Scripts for data saving)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Scripts]]
+
{{TOCright}}[[Category:Scripts]]
== Configuration Template ==
+
== Configuration ==
  
 
A configuration template for each script is available in the corresponding <code>dist/</code> directory.
 
A configuration template for each script is available in the corresponding <code>dist/</code> directory.
  
== Data gathering scripts ==
+
== Parameters ==
  
Mostly all scripts that gather data from equipments to store into PVLng support the following parameters.
+
=== All scripts ===
 +
 
 +
These parameters work with all scripts, for writing data to and reading from PVLng API.
  
 
  -c, --config            Config file [default:script.conf]
 
  -c, --config            Config file [default:script.conf]
  
The default configuration file file depends on the concrete script file name, so for an <code>update.sh</code> the default configuration file is <code>update.conf</code>
+
The default configuration file name depends on the concrete script file name, so for an <code>update.sh</code> the default configuration file will be <code>update.conf</code>
  
  -l, --localtime          Use local time, rounded to ? seconds [default:0]
+
  -t, --test              Test mode, set verbosity to info level [flag]
  
If you gather the data with external hardware (e.g. a Raspberry), you can define that the "lokal" time will be used.
+
Gather only the data, make required transformations and display what would be send to the API server.
You can for example also define, that the timestamp always is rounded to full minute with <code>-l 60</code>.
+
Set also verbosity to level 1.
  
  -s, --save              Save data also into log file [flag]
+
  -v, --verbose            Verbosity, use multiple times for higher level [flag]
  
This is helpful, if the connection to the API server is not stable. This help to load missing data later.
+
More information, multiple <code>-v</code> increase up to level 3, which then also makes cUrl calls verbose.
  
-t, --test              Test mode, set verbosity to info level [flag]
+
=== Data saving scripts ===
  
Gather only the data, make required transformations and display what would be send to the API server.
+
Data gathering scripts can run on different equipments than the API, e.g. on a Raspberry or so.
Set also verbosity to level 1.
 
  
  -v, --verbose            Verbosity, use multiple times for higher level [flag]
+
  -l, --localtime          Use local time, rounded to ? seconds [default:0]
  
More information, multiple <code>-v</code> increase up to level 3
+
You can define that the "local" time will be used.<br />You can for example also define, that the local timestamp always is rounded to full minute with <code> --localtime 60</code>
  
== Data readout scripts ==
+
-s, --save              Save data also into log file [flag]
  
 +
Save the data also locally, this is helpful if the connection to the API server is not stable. Missing data can loaded later manually.
  
== Initial test ==
+
== Test ==
  
 
  $ ./script.sh -t                # Simple test with default configuration, verbose level 1
 
  $ ./script.sh -t                # Simple test with default configuration, verbose level 1
 
  $ ./script.sh -tvc config.conf  # Test with defined configuration, verbose level 2
 
  $ ./script.sh -tvc config.conf  # Test with defined configuration, verbose level 2
 
  $ ./script.sh -tvv              # Test with verbose level 3 also shows cUrl details
 
  $ ./script.sh -tvv              # Test with verbose level 3 also shows cUrl details
 +
 +
== Productive use ==
 +
 +
By default (without <code>-v</code> flag) no output is produced at all.
 +
 +
So you can run any script in crontab without redirecting the output. '''But if''' there is any output, then an error occurred...

Latest revision as of 13:44, 5 August 2016

Configuration

A configuration template for each script is available in the corresponding dist/ directory.

Parameters

All scripts

These parameters work with all scripts, for writing data to and reading from PVLng API.

-c, --config             Config file [default:script.conf]

The default configuration file name depends on the concrete script file name, so for an update.sh the default configuration file will be update.conf

-t, --test               Test mode, set verbosity to info level [flag]

Gather only the data, make required transformations and display what would be send to the API server. Set also verbosity to level 1.

-v, --verbose            Verbosity, use multiple times for higher level [flag]

More information, multiple -v increase up to level 3, which then also makes cUrl calls verbose.

Data saving scripts

Data gathering scripts can run on different equipments than the API, e.g. on a Raspberry or so.

-l, --localtime          Use local time, rounded to ? seconds [default:0]

You can define that the "local" time will be used.
You can for example also define, that the local timestamp always is rounded to full minute with --localtime 60

-s, --save               Save data also into log file [flag]

Save the data also locally, this is helpful if the connection to the API server is not stable. Missing data can loaded later manually.

Test

$ ./script.sh -t                # Simple test with default configuration, verbose level 1
$ ./script.sh -tvc config.conf  # Test with defined configuration, verbose level 2
$ ./script.sh -tvv              # Test with verbose level 3 also shows cUrl details

Productive use

By default (without -v flag) no output is produced at all.

So you can run any script in crontab without redirecting the output. But if there is any output, then an error occurred...