Sponsored Content
Full Discussion: Cron Script Question
Top Forums Shell Programming and Scripting Cron Script Question Post 53064 by cbkihong on Saturday 3rd of July 2004 09:35:03 PM
Old 07-03-2004
1. I think you misunderstood my point. So, have you tried out what I suggested and did that work for you? I think it should, otherwise it may mean you need to explicitly specify the classpath in the java command, which is tedious and I will avoid it if ever possible because, depending on the Java project, missing some Java library class paths that exist in the default classpath will render those libraries unloadable.

No, the Java classpath has not changed. Unless you explicitly specify the classpath, the default classpath used by java ALWAYS contains the current directory (.) that's why if you put a Java class that is not in any package (see Java books for "package" if you don't know what Java packages (i.e. namespaces) are and how they work) in the current directory Java can always find it because . is in the classpath. But when you run it from cron, the current directory is not where your class resides, so it cannot be found. That was the point I would like to make in my previous reply.

PATH has nothing to do with class invocation in java UNLESS you install java in non-standard locations. You can qualify java with absolute path but as you said previously it did not work either. Therefore, it seems like Java can be loaded, it just couldn't find the class. Java doesn't use PATH to do anything internally except from to load the java executable itself.

2.
To same file:
java MyClass >~/myLogfile 2>&1

To different file:
java 1>~/stdout.log 2>~/stderr.log

But if for use with cron, I recommend avoid using ~ but to use absolute paths for filenames.

Last edited by cbkihong; 07-04-2004 at 12:20 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Question about Cron jobs?

I can see where the nohup command can come in very handy. My question is, do you have to do something like this (nohup) in order to run certain cron jobs? On the windows side, I have a couple of scripts that basically run continuously, so all I have to do is ctrl-alt-del to lock my workstation,... (2 Replies)
Discussion started by: wmosley2
2 Replies

2. Shell Programming and Scripting

cron question

I'm new to cron, What does this syntax mean? 0 5 * * 1-5 /u08/0ra33/run_arch.sh thanks (2 Replies)
Discussion started by: ted
2 Replies

3. AIX

CRON Question

Could someone please tell me how I might specify in cron that I want a job to run only on the "last saturday" of the month? Thanks. (2 Replies)
Discussion started by: DenD
2 Replies

4. UNIX for Dummies Questions & Answers

question about cron

I have a script which goes out and installs a package on a box remotely and im trying to get it to add a cron job too..but im having a few problems, whilst it does add the entry it wont run unless I connect to the machine , crontab -e, then :wq. This re-reads the configuration file and it will now... (1 Reply)
Discussion started by: hcclnoodles
1 Replies

5. Shell Programming and Scripting

cron question

Folks; I have this script in SUN which if i run it using command line, it works fine, but when i run it using cron, it work but it misses one thing. here's the details #!/bin/bash cd /opt/new_script for i in ./report*Groups.sh; do $i $1; done This script above when runs through cron, it... (4 Replies)
Discussion started by: moe2266
4 Replies

6. Shell Programming and Scripting

cron question

folks; This might sounds stupid, but i tried few ways to solve it without luck. I need to run a job on the first Saturday of every month at 10 pm. so far i'm not sure what am i doing wrong, but every time i set it, it always run every Saturday instead of the first Saturday of every month. Any... (4 Replies)
Discussion started by: moe2266
4 Replies

7. UNIX for Dummies Questions & Answers

Running a script in cron question

There is this script I'd like to put into cron, but it asks for date verification. It'll prompt you to press enter to continue. Usually, 100% of the time the dates are ok, so is there a way to run this script in cron and bypass the "enter" prompt? (3 Replies)
Discussion started by: NycUnxer
3 Replies

8. Shell Programming and Scripting

Question regarding the cron

Hi, We have developed the script which will send an (html)attachment in through mail. The stand alone script is working fine ,but when we schedule it cron the "nail" command is not working that is we are not receving any mail. Following is the command which we used to send the mail. :confused:... (4 Replies)
Discussion started by: Amey Joshi
4 Replies

9. UNIX for Dummies Questions & Answers

cron shell script question

Hi all, hopefully someone out there can give me some tips on how to resolve this I have a simple shell script who -u > /tmp/userlog one of the line stored in userlog when executing shell script manually: jim123 pts/24 2012-03-30 13:02 00:56 4131 (xya.dsfgds.com) one of the... (4 Replies)
Discussion started by: Linux_Novice
4 Replies

10. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies
All times are GMT -4. The time now is 09:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy