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
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
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
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
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
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
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 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
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
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
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
LEARN ABOUT PHP
rar_entry_get
RAR_ENTRY_GET(3) 1 RAR_ENTRY_GET(3)
RarArchive::getEntry - Get entry object from the RAR archive
Object oriented style (method):
SYNOPSIS
public RarEntry RarArchive::getEntry (string $entryname)
DESCRIPTION
Procedural style:
RarEntry rar_entry_get (RarArchive $rarfile, string $entryname)
Get entry object (file or directory) from the RAR archive.
Note
You can also get entry objects using RarArchive::getEntries.
Note that a RAR archive can have multiple entries with the same name; this method will retrieve only the first.
PARAMETERS
o $rarfile
- A RarArchive object, opened with rar_open(3).
o $entryname
- Path to the entry within the RAR archive.
Note
The path must be the same returned by RarEntry::getName.
RETURN VALUES
Returns the matching RarEntry object or FALSE on failure.
EXAMPLES
Example #1
Object oriented style
<?php
$rar_arch = RarArchive::open('solid.rar');
if ($rar_arch === FALSE)
die("Could not open RAR archive.");
$rar_entry = $rar_arch->getEntry('tese.txt');
if ($rar_entry === FALSE)
die("Could get such entry");
echo get_class($rar_entry)."
";
echo $rar_entry;
$rar_arch->close();
?>
The above example will output something similar to:
RarEntry
RarEntry for file "tese.txt" (23b93a7a)
Example #2
Procedural style
<?php
$rar_arch = rar_open('solid.rar');
if ($rar_arch === FALSE)
die("Could not open RAR archive.");
$rar_entry = rar_entry_get($rar_arch, 'tese.txt');
if ($rar_entry === FALSE)
die("Could get such entry");
echo get_class($rar_entry)."
";
echo $rar_entry;
rar_close($rar_arch);
?>
SEE ALSO
RarArchive::getEntries, rar:// wrapper.
PHP Documentation Group RAR_ENTRY_GET(3)