. /etc/profile
dt=date -d @$2 +%Y%m%d
day=date -d @$2 +%Y-%m-%d
prjhome=/home/data/R
cd $prj_home
if [ ! -d "${dt}" ]; then
mkdir ${dt}
fi
cd ${dt}
test_data=$prj_home/${dt}/test_data.txt
hive -e "set hive.cli.print.header=true;select * from temp.temp_mdl_glm_test${dt}"> $test_data
if [ #? -eq 2 ]
then
echo "Error in load hive data"
exit 101
fi
Rscript /home/master/hadoop_project/test/dw/scripts/glm_predcit.R
if [ #? -eq 2 ]
then
echo "Error in run R"
exit 201
fi
hive -e "load data local inpath '' overwrite into table dw.dw_mdl_delay_predict"
if [ #? -eq 2 ]
then
echo "Error in load local data to R"
exit 301
fi
echo "success to predict."
如上所示,每天会有一批数据,然后如何在 r 中传入指定的参数,例如日期,路径,然后开始计算?