Sponsored Content
Top Forums UNIX for Dummies Questions & Answers problem when the script is scheduled to run as cron job Post 302127451 by forumthreads on Wednesday 18th of July 2007 04:52:24 AM
Old 07-18-2007
problem when the script is scheduled to run as cron job

Hello,

I have problem in executing a shell script. When the shell script is executed at the shell prompt the script works successfully but when the same script is run as a cron job it fails to execute the files called within the shell script.

I have scheduled the job in my crontab file as

15 4 * * * /apps/scripts/scm_tools/validset/poa_product/software_product/spvs >
/apps/scripts/scm_tools/logs/software_product_vs.log 2>&1

The spvs file contents are

#!/bin/ksh

#Set DMDB to specify the Base Database for Dimenisons PDIFF command
export DMDB=intermediate/intermediate@PVCS


cd /apps/scripts/scm_tools/validset/poa_product/software_product

sqlplus intermediate/intermediate @/apps/scripts/scm_tools/validset/poa_product/software_product/spvs "%"

# write the initial lines to ptvs.txt to create PDIFF control plan Import file - see Dimenison PDIFF document

echo "#PDIFF3" >> spvs.txt
echo "#DATE 07-JUL-2007" >> spvs.txt
echo "#RESERVED" >> spvs.txt
echo "#RESERVED" >> spvs.txt
echo "#RESERVED" >> spvs.txt
echo "#RESERVED" >> spvs.txt
echo "\n" >> spvs.txt
nawk -f spvs.awk dpq.csv >> spvs.txt

echo "END_OBJECT" >> spvs.txt

#PDIFF command to import SOFTWARE_PRODUCT validset values
pdiff POA -load_cpl -d -l spvs.log -f spvs.txt

#clean up
mv *.log archive
mv *.txt archive
mv *.csv archive




The software_product_vs.log file contains

/apps/scripts/scm_tools/validset/poa_product/software_product/spvs[19]: sqlplus: not found
nawk: can't open file spvs.awk
source line number 1
context is
>>> <<<
/apps/scripts/scm_tools/validset/poa_product/software_product/spvs[45]: pdiff: not found
mv: archive not found
mv: archive not found
mv: cannot access *.csv

I am not sure if the problem is because of the child process being created.
All the files used have execute permissions on them.

Appreciate any suggestions on this.

Many Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Run cron job problem

I have the below crontab job that it will run at every 7:00am - 10:00am , it work fine , now if I want to skip to run the crontab job at a specific time , eg. I want the script not to run at next Monday 8:00am ( only skip this time , other time is normal ) , how can I make it ? is it possible ?... (3 Replies)
Discussion started by: ust
3 Replies

2. Shell Programming and Scripting

Conditional File Movement script scheduled using CRON job

Hi All, i am trying to automate a process and have to create a unix script like wise. I have a scenario in which i need to automate a file movement. Below are the steps i need to automate. 1. Check whether a file (Not Fixed name-Pattern search of file say 'E*.dat') is present in a... (2 Replies)
Discussion started by: imu
2 Replies

3. UNIX for Dummies Questions & Answers

shell script run by user or cron job ?

My shell script runs fine both as a cron job and when i issue it. However, I wish to differentiate when it runs as a cron-job so the "echo" statements are not issued (they get mailed to me, which i don't want). I tried checking $USER but since the cron was created in my user that does not... (5 Replies)
Discussion started by: sentinel
5 Replies

4. Shell Programming and Scripting

script wont run from cron job

I have written a simple bash script that will run a wget command to recursively ftp an entire directories and it's contents. #!/bin/bash wget -r -N ftp://user:pass@server//VOL1/dir If I run from the regular command line it works fine. root@BUSRV: /media/backup1$ ./gwbu When I put it in... (1 Reply)
Discussion started by: mgmcelwee
1 Replies

5. UNIX for Advanced & Expert Users

Need help with a script run by a cron job.

Hi, new to this forum and not sure if this is the right place to post. I'm new to cron jobs and scripts, and I need some help with a script to be used with a cron job. I already have a bot set up at a certain website address and need a script that the cron job will load every day that tells it to... (1 Reply)
Discussion started by: klawless
1 Replies

6. Solaris

Shell Script gives error when run through cron job.

Hi, The following shell script runs without any problem when executed manulally. USED=$(df -h /arch | tail -1 | awk '{print $5}' | cut -d '%' -f 1) if then find /arch/AUBUAT/ -type f -mtime +0 | xargs rm find /arch/AUBMIG/ -type f -mtime +0 | xargs rm fi But the same gives below... (6 Replies)
Discussion started by: ksadiq79
6 Replies

7. Shell Programming and Scripting

how do I run bash script using cron job

How do I run bash script using a cron job? I have tried to just write the path of the script, but that didn't work. (1 Reply)
Discussion started by: locoroco
1 Replies

8. Shell Programming and Scripting

run unix script as scheduled job

Hi, I want my unix script to run as a scheduled job such that the script is invoked once every 15 minutes. Is there any way to achieve this other than running the script as a cron job? (2 Replies)
Discussion started by: vignesh53
2 Replies

9. Shell Programming and Scripting

Script that will send an email if the cron job did not run.

Team, Would like to know what is the best script that will send you an email if cronjob did not run. Thanks (4 Replies)
Discussion started by: kenshinhimura
4 Replies

10. UNIX for Beginners Questions & Answers

Cron job scheduled is running once, but reports are generating twice

Team, Hope you all are doing fine I have one admin server which is being used dedicately to run cron jobs on hourly basis, fetching the details from Database which is in a different server.These cronjob are run on every hourly/5 minutes basis depending as per end user requirement.The script... (12 Replies)
Discussion started by: whizkidash
12 Replies
PHAR.INTERCEPTFILEFUNCS(3)						 1						PHAR.INTERCEPTFILEFUNCS(3)

Phar::interceptFileFuncs - instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions

SYNOPSIS
finalpublicstatic void Phar::interceptFileFuncs (void ) DESCRIPTION
instructs phar to intercept fopen(3), readfile(3), file_get_contents(3), opendir(3), and all of the stat-related functions. If any of these functions is called from within a phar archive with a relative path, the call is modified to access a file within the phar archive. Absolute paths are assumed to be attempts to load external files from the filesystem. This function makes it possible to run PHP applications designed to run off of a hard disk as a phar application. PARAMETERS
No parameters. RETURN VALUES
EXAMPLES
Example #1 A Phar.interceptFileFuncs(3) example <?php Phar::interceptFileFuncs(); include 'phar://' . __FILE__ . '/file.php'; ?> Assuming that this phar is at /path/to/myphar.phar and it contains file.php and file2.txt, if file.php contains this code: Example #2 A Phar.interceptFileFuncs(3) example <?php echo file_get_contents('file2.txt'); ?> Normally PHP would search the current directory for file2.txt, which would translate as the directory of file.php, or the current direc- tory of a command-line user. Phar.interceptFileFuncs(3) instructs PHP to consider the current directory to be phar:///path/to/myphar.phar/ and so opens phar:///path/to/myphar.phar/file2.txt in the above example code. PHP Documentation Group PHAR.INTERCEPTFILEFUNCS(3)
All times are GMT -4. The time now is 10:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy