Difference between revisions of "HIP:PMP:Database"

From Earlham CS Department
Jump to navigation Jump to search
(NOTE)
Line 15: Line 15:
  
 
'''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:
 
** Warning: The network will still get disabled whenever the "log.pl" runs. To avoid this, comment out all lines with:

Revision as of 15:43, 12 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.