首先写一个脚本select_app02.sh如下:
#!bin/bash
hive -e "drop table default.tbl_play_pt_small_0;create table default.tbl_play_pt_small_0 as select a.p1,a.p2,a.deviceid from data_raw.tbl_play_hour a where a.dt=20150322 and a.letv_cookie='-' and a.hour != 27;"
if [ $? -ne 0 ] ;then
exit 1
fi
然后在集群后台中运行如下:nohup sh select_app02.sh > lzy.log &
其中lzy.log 可以查看脚本的运行情况