Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UNIX shell script help

 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

i have load.bat file in my windows ...
IN WINDOWS
we have a loader.exe file which loads the data in some queue.We keep this data in a particular folder i.e "in" folder. Now this loader.exe file picks the data from the "in" folder and loads it in an MQueue.I dont know exactly how this loader.exe file works but w.r.t this questn i dont think its imp...

Now we created a load.bat file


c:
cd c:/prjct/Java/bin ( )

Loader.exe -t ABC.cfg -f c:/prjct/Java/in/Data
Loader.exe -t DEF.cfg -f c:/prjct/Java/in/Data1




Things in bold above is contained in load.bat file....
as i told you "in" is the folder where we have data which is picked up by loader.exe

ABC.cfg and DEF.cfg files are 2 config files( Since data is in GFF i.e Generic File Format)

IN UNIX
Now i need a shell script which does the same work as "load.bat" . ( I guess i have loader.exe in my unix box...and it works fine....)
i just need a shell script syntax which does the same thing as load.bat file did in windows

[ August 06, 2008: Message edited by: Maan Shenoy ]
[ August 06, 2008: Message edited by: Bear Bibeault ]
 
denis sorn
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! I am not sure if I have understood you well, but if all you want is to start this commands:

Loader.exe -t ABC.cfg -f c:/prjct/Java/in/Data
Loader.exe -t DEF.cfg -f c:/prjct/Java/in/Data1

from a file just put them in a file and make it executable. I.e.

touch loader.sh && chmod +x loader.sh && echo "Loader.exe -t ABC.cfg -f c:/prjct/Java/in/Data" >> loader.sh && echo "Loader.exe -t DEF.cfg -f c:/prjct/Java/in/Data1" >> /loader.sh

Of course you have to adjust paths. Now you could execute it by typing in shell ./loader.sh or sh loader.sh. That is in case you are in dir where is the file. when not just type full path.

If you want to start them upon boot process or periodicaly consider putting that command in some startup script (this depends on distribution. I think /etc/rc.d/rc.local is for debian, ubuntu and /etc/conf.d/local.start on gentoo) or in cron for periodcal executing.
 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Above shell script is saved as load.sh
now i go to my bin folder and run the load.sh
in unix



/dq5/bin$ load.sh

output
/dq5/bin (because of echo command)

load.sh[12]: /dq5/bin: 0403-006 Execute permission denied.
load.sh[13]: /dq5/bin: 0403-006 Execute permission denied.


Getting execute permission denied error...what is required to be done?
Please I require it as soon as possible....
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you given the permission to executable?

chmod +x load.sh
 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks freddy....



above shell script works without error but doesnot perform intended operation.Can anyone help in this?

even when i tried giving a file name which doesnot exist ,it ran without any erros but didnot perform the loading which i was expecting to happen......
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you try to run
/dq5/bin/loader -t abc.cfg -f /dq5/java/data.txt
from your shell and see what happens?
 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks....

i tried but getting some timestamp issue.That command runs fine but gets some timestamp issue

*** ERROR ***
SQL ERROR occured: Prepare UPDATE.
SQLCODE: -818
SQL0818N A timestamp conflict occurred. SQLSTATE=51003
SQLSTATE 51003: Consistency tokens do not match.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic