source $HOME/.bash_profile
PRE_DATE=`date +"%Y-%m-%d" -d "-1days"`
if [ $# -ne 0 ];then
PRE_DATE=$1;
fi
python test5.py $PRE_DATE
echo "delete from lsb_cbh_test;"> test1.sql
psql "host=10.100.0.254 hostaddr=10.100.0.254 port=5433 user=sys_report password=report2hhl dbname=sysreport" -f test1.sql
#echo "\COPY lsb_cbh_test FROM ‘test_1.csv‘ delimiter as‘,‘ NULL as ‘null‘ ;">test.sql
echo "\COPY lsb_cbh_test(type_id,cuid) FROM ‘test11_new.txt‘ delimiter as‘,‘ ;">test.sql
psql "host=10.100.0.254 hostaddr=10.100.0.254 port=5433 user=sys_report password=report2hhl dbname=sysreport" -f test.sql
v_date=`echo $PRE_DATE|sed ‘s/-//g‘`
echo "select sp_stat_client_visit(‘$v_date‘);" >test2.sql
psql "host=10.100.0.254 hostaddr=10.100.0.254 port=5433 user=sys_report password=report2hhl dbname=sysreport" -f test2.sql
原文地址:https://www.cnblogs.com/phoneber/p/8203571.html