File "test.php"

Full path: /www/shimooguni/recv/test.php
File size: 939 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Back

<?php
$HOST = "192.168.100.153";
$DB = "shimooguni";
$USER = "postgres";
$PASS = "postgres";


$DATA_TABLE = "weather.data_log";
$DATA_TABLE_1H = "weather.data_log_1h";
$DATA_TABLE_DAY = "weather.data_log_day";
$DATA_TABLE_WEEK = "weather.data_log_week";
$DATA_TABLE_MONTH = "weather.data_log_month";
$DATA_TABLE_NEW = "weather.data_log_new";



//================================================
//	データベース接続
//	備考		:	
//	更新		:	2013/03/12 KMK-Yokosuka
//================================================
$conn = pg_connect("
	host	=	". $HOST. "
	dbname	=	". $DB. "
	user	=	". $USER. "
	password=	". $PASS. "
");

$csv = "/www/shimooguni/recv/new_.csv";

//$cm = "sudo -u postgres psql shimooguni -c \" COPY " .$DATA_TABLE_1H ." FROM '" .$csv ."' WITH CSV\"";

$cm = "sudo -u postgres psql shimooguni -c \" COPY weather.data_log_1h FROM '/www/shimooguni/recv/new_.csv' WITH CSV\"";
print $cm;
$a = exec($cm);

?>

PHP File Manager