Difference between revisions of "HIP:PMP:Database"
Jump to navigation
Jump to search
(→PMP1 Scripts) |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
** This script simply sends all the data from the files in "/root/logs" to a database called "pmp1" on quark. | ** This script simply sends all the data from the files in "/root/logs" to a database called "pmp1" on quark. | ||
− | '''NOTE''' | + | '''NOTE:''' |
* To prevent "log.pl" from disabling the network through cron, execute the script | * To prevent "log.pl" from disabling the network through cron, execute the script | ||
"/root/kill_jobs.sh" and don't forget to execute "/root/restore_jobs.sh" after you are done. | "/root/kill_jobs.sh" and don't forget to execute "/root/restore_jobs.sh" after you are done. | ||
− | + | ||
+ | '''Warning:''' | ||
+ | * The network will still get disabled whenever the "log.pl" runs. To avoid this, comment out all lines with: | ||
system("/root/scripts/net_disconnect.sh"); | system("/root/scripts/net_disconnect.sh"); | ||
Line 23: | Line 25: | ||
or | or | ||
− | + | temporarily rename "/root/scripts/net_disconnect.sh" | |
==Database on Quark== | ==Database on Quark== | ||
Line 34: | Line 36: | ||
* To view the wind data, execute: | * To view the wind data, execute: | ||
− | weather=# select * from pmp1 order by id desc; | + | weather=# select * from pmp1 order by id desc; |
* This will list the wind data beginning with the latest entries. | * This will list the wind data beginning with the latest entries. |
Latest revision as of 12:16, 17 July 2007
PMP1 Scripts
The pmp1 has 2 main scripts that handle wind data. All pmp1 scripts are located in "/root/scripts/"
- The first script is "log.pl"
- This script collects speed1, speed2, direction1, direction2 and box_temperature.
- It then records them in files in "/root/logs/".
- The script is run buy cron every 15 minutes and it also records a state value.
- When the state value is 4, the script wakes up the network, resets the state value to 0, and executes the second main script.
- The second script is "dbi.pl"
- This script simply sends all the data from the files in "/root/logs" to a database called "pmp1" on quark.
NOTE:
- To prevent "log.pl" from disabling the network through cron, execute the script
"/root/kill_jobs.sh" and don't forget to execute "/root/restore_jobs.sh" after you are done.
Warning:
- The network will still get disabled whenever the "log.pl" runs. To avoid this, comment out all lines with:
system("/root/scripts/net_disconnect.sh");
or
temporarily rename "/root/scripts/net_disconnect.sh"
Database on Quark
- To access the database, you have to log to quark and execute:
nerd@quark$ psql -U weather
or
nerd@quark$ psql -U hip
- The password is the "default" hip/weather.
- To view the wind data, execute:
weather=# select * from pmp1 order by id desc;
- This will list the wind data beginning with the latest entries.