File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes UNIX shell script help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "UNIX shell script help" Watch "UNIX shell script help" New topic
Author

UNIX shell script help

Maan Suraj
Ranch Hand

Joined: Dec 20, 2007
Posts: 299
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 ]

Man Suraj
Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"
denis sorn
Ranch Hand

Joined: Apr 30, 2008
Posts: 33
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

Joined: Dec 20, 2007
Posts: 299


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

Joined: Sep 11, 2006
Posts: 959

Have you given the permission to executable?

chmod +x load.sh


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Maan Suraj
Ranch Hand

Joined: Dec 20, 2007
Posts: 299
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

Joined: Sep 11, 2006
Posts: 959

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

Joined: Dec 20, 2007
Posts: 299
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: UNIX shell script help