Connecting Tech Pros Worldwide Forums | Help | Site Map

problem in running shell script from cron

Newbie
 
Join Date: Oct 2007
Posts: 25
#1: Apr 15 '08
#! /bin/bash



javac CopyFile.java
/usr/bin/java CopyFile



this is my shell script.when i call this script from terminal works fine.but through cron it gives me error saying exception i think it is not able to find the files that i have imported
such as
import java.io.*;
import java.util.*;
import java.lang.*;
import java.text.*;
import java.io.File;

help me out

ashitpro's Avatar
Expert
 
Join Date: Aug 2007
Posts: 390
#2: Apr 15 '08

re: problem in running shell script from cron


Have you redirected the output of your command...
Do it first and post the content of that file here...
gpraghuram's Avatar
Expert
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,258
#3: Apr 15 '08

re: problem in running shell script from cron


Quote:

Originally Posted by smitanaik

#! /bin/bash



javac CopyFile.java
/usr/bin/java CopyFile



this is my shell script.when i call this script from terminal works fine.but through cron it gives me error saying exception i think it is not able to find the files that i have imported
such as
import java.io.*;
import java.util.*;
import java.lang.*;
import java.text.*;
import java.io.File;

help me out

Check whether the JAVA path is set properly.
Try to write a small shell script and then set the JAVA path in it and then call the commad.
Set this shell script in a cron and i think it will work

Raghuram
Reply