User Tools

Site Tools


doc:grb_scripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:grb_scripts [2009/03/24 23:27] pkubanekdoc:grb_scripts [Unknown date] (current) – external edit (Unknown date) 127.0.0.1
Line 17: Line 17:
 </code> </code>
  
-  * **camera_name** hold name of camera. It must reference to //cameras// table.+  * **camera_name** hold name of camera. It must reference to //cameras// table. Usually you will encounter only single camera in the system, which will be called **C0**.
  
   * **grb_script_end** is time after GRB when this script will **NOT** be used. If it's //NULL//, this is default script. 600 in this field means that script will be used up to 600 seconds (10 minutes) after GRB trigger. After this time, script with bigger number in **grb_script_end**, or **grb_script_end** left NULL, will be used   * **grb_script_end** is time after GRB when this script will **NOT** be used. If it's //NULL//, this is default script. 600 in this field means that script will be used up to 600 seconds (10 minutes) after GRB trigger. After this time, script with bigger number in **grb_script_end**, or **grb_script_end** left NULL, will be used
Line 50: Line 50:
 user@host:~$ psql stars < grb_script user@host:~$ psql stars < grb_script
 </code> </code>
 +
 +===== Updating by using psql =====
 +//The following is added by someone learning the system and is not official://
 +
 +Since the grb_script table in the stars database is properly set to have the constrain of being UNIQUE, if the method described above is attempted for updating the script psql will refuse to add it again and will output among other things:
 +<code bash>
 +ERROR:  relation "grb_script" already exists
 +</code>
 +This can be circumvented by simply using psql to edit the table.
 +<code bash>
 +user@host:~$ psql stars
 +stars=> UPDATE grb_script SET grb_script_script = 'filter=0 E 30' WHERE grb_script_end = '600' and camera_name="C5";
 +stars=> INSERT INTO grb_script VALUES ('C5', '300', 'filter=0 EMON=off filter=C E 30');
 +stars=> UPDATE grb_script SET grb_script_script = 'filter=0 E 180' WHERE grb_script_end IS NULL and camera_name="C5";
 +</code>
 +
 +Note that:
 +  - The first command will update what camera C5 will do until 10 minutes
 +  - The second command will insert the previously undefined behaviour for C5 that will happen until 300 seconds
 +  - And the third will update that which will be done after all other defined behaviours. Note that for this case the column is not search by a literal expression like '\N' but by the condition "IS NULL"
doc/grb_scripts.1237933626.txt.gz · Last modified: 2009/03/24 00:00 (external edit)