LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-23-2006, 09:17 PM   #1
somsahi
Member
 
Registered: Aug 2006
Posts: 44

Rep: Reputation: 15
cron job


Hi i have script
#!/bin/sh
cd /home/wasadmin/jar /usr/java/j2sdk1.4.2_12/bin/java -jar /home/wasadmin/jar/A.jar
echo hello

but in mail I am getting nothing except hello.
and jar is not working as expected from this script but from command line (/usr/java/j2sdk1.4.2_12/bin/java -jar /home/wasadmin/jar/A.jar)its working.
I am running this command from /home/wasadmin/jar directory


regards
 
Old 10-24-2006, 02:24 AM   #2
baikonur
Member
 
Registered: Oct 2005
Location: germany
Distribution: debian
Posts: 255
Blog Entries: 5

Rep: Reputation: 30
#!/bin/sh
cd /home/wasadmin/jar; /usr/java/j2sdk1.4.2_12/bin/java -jar /home/wasadmin/jar/A.jar
echo hello
 
Old 10-24-2006, 06:40 AM   #3
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
A few tips:
1. Try putting separate commands on separate lines, or, as suggested, put ";" to separate them.
2. Try running the script from command line before running it from cron.
3. When pasting code & commands on this forum, try enclosing them in tags. That makes it
much more readable.
4. You may need to set some environment variables (ie JAVA_HOME) for this script to work properly. You can do this at the top of your crontab settings, or by "source"ing your .bashrc (or other) file directly in the script.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cron job somsahi Linux - Software 9 10-05-2006 03:19 PM
Cron job rust8y Linux - Newbie 3 05-18-2006 10:06 AM
cron job the_rhino Linux - Newbie 10 10-02-2004 04:34 PM
CRON Job tommytomato Fedora 12 09-13-2004 01:38 AM
Cron job T-Rex Linux - Newbie 1 09-26-2001 12:28 PM


All times are GMT -5. The time now is 02:55 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration