Problem in Crontab [message #200712] |
Wed, 01 November 2006 01:05 |
oracledba_raja
Messages: 23 Registered: July 2006
|
Junior Member |
|
|
Hi All,
Good Afternoon.
I have a script combinedprocess.sh.
Which in turn, calls another 2 shell programs process1.sh, process2.sh
When I am manually execute the file, it works fine.
Then, I have scheduled the shell script combinedprocess.sh in crontab.
It didn’t give any output all.
I need your help.
=================================================================
/lms/billing =>cat combinedprocess.sh
#!/bin/sh
sh process1.sh
sh process2.sh
================================================================
Entry in Crontab
00 09 * * * /lms/billing/combinedprocess.sh
================================================================
File permission:
-rwxrwxrwx 1 lmsuser lms 46 Oct 31 17:57 combinedprocess.sh
-rwxr-xr-x 1 lmsuser lms 998 Oct 31 17:38 process1.sh
-rwxr-xr-x 1 lmsuser lms 995 Oct 31 17:38 process2.sh
Thanks and Regards,
Raja
|
|
|
|
Re: Problem in Crontab [message #200856 is a reply to message #200851] |
Wed, 01 November 2006 12:12 |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
if you have a bunch of environment settings, you can also specify the environment profile either in crontab - or just at the top of your main script.
0 6 * * * . ~/cron_env; /home/oracle/scr/app/reminder >/tmp/reminder 2>&1
|
|
|
|
Re: Problem in Crontab [message #200988 is a reply to message #200712] |
Thu, 02 November 2006 02:47 |
oracledba_raja
Messages: 23 Registered: July 2006
|
Junior Member |
|
|
Hi Mahaesh & Andrew,
Thanks for your response.
I have given the full path the 'combinedprocess.sh'
/lms/billing/process1.sh
/lms/billing/process2.sh
and it works fine.
Thanks a lot.
One more doubt...
Can't we use 'cp' & 'mv' commands inside a script?
I just gave 'cp' as follows, in a shell as part of it.
#!/bin/ksh
cp disk3/ipp/outbound/prod/history/history.txt disk3/ipp/outbound/prod/historybackup
Other than this, all other things are working fine.
How to overcome this?
Could you please guid me.
Thanka a lot.
Thanks and Regards,
Raja
|
|
|
|
|
Re: Problem in Crontab [message #201121 is a reply to message #201009] |
Thu, 02 November 2006 11:34 |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
You can use virtually any command you want in crontab - you just need to be sure to set up all your environment variables. Run "env" to show your current environment, pick out the ones you need and put them into the top of your script - or source the environment file like I showed (cron_env).
#find where cp is
Dev1>>which cp
#find where mv is
Dev1>>which mv
/usr/bin/mv
Dev1>>which ping
/usr/sbin/ping
e.g.
----- cron_env ----
export PATH=/usr/bin:/usr/sbin:/users/home/myscripts:.
export LOG=/tmp/mylog.txt
|
|
|
Re: Problem in Crontab [message #201186 is a reply to message #200712] |
Thu, 02 November 2006 22:42 |
oracledba_raja
Messages: 23 Registered: July 2006
|
Junior Member |
|
|
Hi Andrew,
Thanks a lot.
In the env file, I found
_=/usr/xpg4/bin/env
HOME=/disk3/ses/inbound/prod/bin
SHELL=/usr/bin/ksh
PWD=/disk3/ses/inbound/prod/bin
It has been set by my predecessor in my present company.
He also set some jobs in crontab,
#00 10 * * * /disk3/ses/inbound/prod/bin/dof 1>> /disk3/ses/inbound/prod/log/pdx-neg.cron.log 2>> /disk3/ses/inbound/prod/log/pdx-neg.cron.errors
#10 10 * * * /disk3/ses/inbound/prod/bin/uf 1>> /disk3/ses/inbound/prod/log/pdx-neg.cron.log 2>> /disk3/ses/inbound/prod/log/pdx-neg.cron.errors
Now, I am working in different directory and that is
/disk3/ipp/outbound/prod/bin
but for logging still using his id.
As I am using his id, when I logged in I am in his directory
=/disk3/ses/inbound/prod/bin.
Then I use to change to my working directory.
Now, I have scheduled a job in a crontab.
45 10 * * * /disk3/ipp/outbound/prod/bin/renamefiles.sh >> /disk3/ipp/outbound/prod/bin/batchjob.log
The executable files are in
/disk3/ipp/outbound/prod/bin and it's subdirecotry.
Now, I found, the output of the crontab,
writes in his directory ..ie) in
/disk3/ses/inbound/prod/bin
I won't be allowed to change any settings, set by him.
As a part of crontab, the files are executing from my directory.
/disk3/ipp/outbound/prod/bin
The problem is,
As I said earlier, the output file has been written to his directory '/disk3/ses/inbound/prod/bin'
How to make the files to be written to my directory?
As I am not allowed to change the settings,
How I can specify the settings in my codings to get desired output?
I am very sorry.. My question may sound stupid..
Could you please guide me...
Thanks for your time to go thru this lengthy mail.
Thanks a lot.
Thanks,
Raja
|
|
|