Hi ,
I have prepared the following shell script to run the hqls in background.
These scripts are running Parallel but I want to run the hqls sequentially in background.
cat >cc_script.ksh
nohup hive -hiveconf rrdt=2016-06-12 -f /home/files/cust1.hql > home/log/cust1.log 2>&1 &
nohup hive -hiveconf rrdt=2016-06-12 -f /home/files/cust2.hql > home/log/cust2.log 2>&1 &
nohup hive -hiveconf rrdt=2016-06-12 -f /home/files/cust3.hql > home/log/cust3.log 2>&1 &
nohup hive -hiveconf rrdt=2016-06-12 -f /home/files/cust4.hql > home/log/cust4.log 2>&1 &
ksh cc_script.ksh
Thanks in advance.
RudiC
October 10, 2016, 1:56am
2
Then, remove the nohup
s and &
s and run the entire script in background.
Hi,
Please help me how to run in background.
Thanks
Did you not understand RudiC's post?
Let me help...
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust1.hql > home/log/cust1.log 2>&1
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust2.hql > home/log/cust2.log 2>&1
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust3.hql > home/log/cust3.log 2>&1
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust4.hql > home/log/cust4.log 2>&1
zaxxon
October 10, 2016, 2:50am
6
@OP :
Please stop ignoring helpful answers and just stop repeating your demanding behaviour if it is not already presented in a way, that you can copy & paste it. This is very bad behaviour. You can always ask, if you don't understand something.
Start using your brain. This also involves communication and communication goes in both ways.
You will be banned if you don't change your behaviour.
cheers
zaxxon
1 Like
As you have already been told, the obvious way to do that would be to change your script to:
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust1.hql > home/log/cust1.log 2>&1
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust2.hql > home/log/cust2.log 2>&1
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust3.hql > home/log/cust3.log 2>&1
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust4.hql > home/log/cust4.log 2>&1
and run your script with:
ksh cc_script.ksh&
If the backgrounding needs to be done inside your script, you could use:
{
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust1.hql > home/log/cust1.log 2>&1
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust2.hql > home/log/cust2.log 2>&1
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust3.hql > home/log/cust3.log 2>&1
hive -hiveconf rrdt=2016-06-12 -f /home/files/cust4.hql > home/log/cust4.log 2>&1
}&
wait
and run your script with:
ksh cc_script.ksh
or:
ksh cc_script.ksh&