Personal tools

Epi:Comandos de conexión al servidor

From hpcwiki

Jump to: navigation, search
#!/bin/bash  
# Shell Script to create the postgresql database and to import the epidemiology data
# Raúl Ernesto Menéndez-Mora - 03/March/2015


#sinchronization from outside of the local network in UCentral
rsync -azve "ssh -p 30022" /home/raul/temp rmenendez@190.60.115.153:/media/hpclab-data/epidemiology_HSur/data

rsync -azve "ssh -p 30022" /home/raul/Dropbox/Work/UCentral/epidemiology_HSur/scripts rmenendez@190.60.115.153:/media/hpclab-data/epidemiology_HSur/data

#connecting to the server through ssh 
ssh -p 30022 -o "ServerAliveInterval=180" rmenendez@190.60.115.153 
ssh -o "ServerAliveInterval=180" rmenendez@172.20.150.34 


#keep ssh connection alive
autossh -M 0 -q -f -N -L 33333:localhost:5432 rmenendez@190.60.115.153 -p 30022 -o "ServerAliveInterval=180"
autossh -M 0 -q -f -N -L 33333:localhost:5432 rmenendez@172.20.150.34 -o "ServerAliveInterval=180" 

#sshfs to mount the remote directory from the server into the working machine
sshfs -p 30022 -o "ServerAliveInterval=180" rmenendez@190.60.115.153:/ /home/raul/hpclabCluster/
sshfs -o "ServerAliveInterval=180" rmenendez@172.20.150.34:/ /home/raul/hpclabCluster/


#install R && RPostgreSQl

sudo vim /etc/apt/sources.list  
#append this line
#deb http://www.icesi.edu.co/CRAN/bin/linux/ubuntu trusty/
#deb http://www.icesi.edu.co/CRAN/ trsuty-backports main restricted universe 

sudo apt-get update &&
sudo apt-get install libpq-dev r-base r-base-dev

# Install R package from command line
sudo R CMD INSTALL lattice_0.20-31.tar.gz 
sudo R CMD INSTALL googleVis_0.5.8.tar.gz 
sudo R CMD javareconf


##INSIDE r
> install.packages('DBI')
> install.packages('RPostgreSQL')
# package pastecs has an easy to use function called stat.desc to display a table of descriptive statistics for a list of variables
> install.packages("pastecs")
> install.packages("boot")
> install.packages("Hmisc")
> history(max.show=Inf) # display all previous commands
> getwd()
> savehistory(file="myfile") # default is ".Rhistory" 
> save(object list,file="myfile.RData") 
> load("myfile.RData") 
> install.packages('spacetime')
> install.packages('RJSONIO')
> install.packages('surveillance')
> install.packages('rJava')
> install.packages('iplots')
> install.packages('maptools')
> install.packages('spdep')
> install.packages('gstat')
> install.packages('plm')

> library(DBI)
> library(RPostgreSQL)
> library(boot)
> library(pastecs)
> library(Hmisc)
> library(spacetime)
> library(MASS)
> library(surveillance)
> library(iplots)

> drv <- dbDriver("PostgreSQL")
> con <- dbConnect(drv, dbname="epidemiology_db", host="localhost", user="postgres", password="", port=33333)
> tableXX <- dbGetQuery(con, "select * from \"AC_IRA_VIEW\"")
> summary(tableXX)

> dim(tableXX)

> describe(tableXX[,c(11,12,13,14)])
> delay1 <- as.numeric(tableXX$"FEC_CONSULTA"-as.Date('2009-01-01'))
> hist(delay1, col="gray", xlab="Days after 2009-01-01",main="Number of cases reported")


#sinchronization from local network in UCentral
rsync -azve "ssh" /home/raul/temp rmenendez@172.20.150.34:/media/hpclab-data/epidemiology_HSur/