cancel
Showing results for 
Search instead for 
Did you mean: 

Cron script not running

 
Highlighted
Regular Advisor

Cron script not running

Hello,

When i run cron job its not runnning it getting error message...

but when i run the script manuall its running without problem....

Script file...

prodata1#more /tmp/tar
#!/bin/sh -x
su - dbprod -c /tmp/ddd
cd /c10/tar-backup
chmod -R 777 /c10/tar-backup
chown -R dbprod:dba /c10/tar-backup
rm -rf DB_OH.tar.gz.*
rm -rf DB_STAGE.pax.gz.*
#sleep 8
cd /c10
chown -R dbprod:dba /c10/tar-backup
chmod -R 777 /c10/tar-backup

su - dbprod -c /tmp/ddd
pax -w -v -x pax prodbkp | gzip > /c10/tar-backup/DB_STAGE.pax.gz
su - dbprod -c /tmp/ddd
mv /c10/tar-backup/DB_STAGE.pax.gz /c10/tar-backup/DB_STAGE.pax.gz.`date +%d%m%Y`
su - dbprod -c /tmp/ddd
sleep 10
cd /c02/rachome
tar cvf - 11.1.0 | gzip > /c10/tar-backup/DB_OH.tar.gz
su - dbprod -c /tmp/ddd
mv /c10/tar-backup/DB_OH.tar.gz /c10/tar-backup/DB_OH.tar.gz.`date +%d%m%Y`

prodata1#

 

Kindly find the below output of crontab ...error meaasge!!!

 

prodata1#crontab -e
"/var/tmp/aaa020610" 16 lines, 743 characters
# Entry for monitoring status of the EMSHAProvider
 5,20,35,50   *    *    *    *   /etc/opt/resmon/lbin/mon_EMSHAProvider_state.sh
 # Entry for vacuuming the EMT CER DB
 5   1    *    *    *    /opt/sfm/vacuum
 5,20,35,50   *    *    *    *    /opt/sfm/bin/restart_sfm.sh
#15 10 * * * /c01/.syslog1.sh
#00 22 * * * /c03/scripts/BACKUP_PROD_DAILY.sh
#30 23 * * 6 /c03/scripts/BACKUP_STAGE_WEEKLY.sh
00 19 * * 6 /c03/scripts/Database_FULL_Weekly_backup.sh
58 14 * * 5 /tmp/tar >> /tmp/mysqlbackup.log 2>&1
#30 22 * * 6 /opt/nfs-restart
#30 15 * * 1 /c03/scripts/tartest
00 10-19 * * 1-6 /c03/scripts/BACKUP_ARCHIVELOG_HOURLY.sh
00 22 * * 1-6 /c03/scripts/BACKUP_DB_INCREMENTAL_DAILY.sh
00 22 * * 0 /c03/scripts/BACKUP_DB_INCREMENTAL_WEEKLY.sh

~
~
~
~
~
~
~
"/var/tmp/aaa020610" 16 lines, 743 characters
warning: commands will be executed using /usr/bin/sh
prodata1#date
Fri Jun 17 14:56:38 IST 2016
prodata1#date
Fri Jun 17 14:57:32 IST 2016
prodata1#tail -100 /tmp/mysqlbackup.log
/dev/tar-backup/tar-backup
                   346030080 327477939 17392684   95% /c10
+ date +%d%m%Y
+ mv /c10/tar-backup/DB_STAGE.pax.gz /c10/tar-backup/DB_STAGE.pax.gz.17062016
+ su - dbprod -c /tmp/ddd
ttytype: couldn't open /dev/tty for reading
stty: : Not a typewriter
(c)Copyright 1983-2006 Hewlett-Packard Development Company, L.P.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-2000 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993  The Open Software Foundation, Inc.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2006 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
(c)Copyright 1996 Progressive Systems, Inc.

Confidential computer software. Valid license from HP required for
possession, use or copying.  Consistent with FAR 12.211 and 12.212,
Commercial Computer Software, Computer Software Documentation, and
Technical Data for Commercial Items are licensed to the U.S. Government
under vendor's standard commercial license.

You have mail.
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter
                                                                                             Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3    4194304  619432 3546976   15% /
/dev/vg00/lvol1    3145728  319832 2803896   10% /stand
/dev/vg00/lvol8    41943040 29456984 12465504   70% /var
/dev/vg00/lvol7    15728640 3187704 12443000   20% /usr
/dev/vg00/lvol6    5242880   89848 5114816    2% /tmp
/dev/vg00/lvol5    15728640 5982912 9670408   38% /opt
/dev/vg00/lvol4    2097152  851296 1236200   41% /home
/dev/c04/c04       52428800 28381731 22544245   56% /c04
/dev/oravg02/c03   630194176 345826147 266747820   56% /c03
/dev/ORAVG01/c02   141557760 108405180 31383155   78% /c02
/dev/new-c/c01     9437184 7246215 2056288   78% /c01
/dev/app-backup/app-bacup
                   56623104 40885879 14753712   73% /app-backup
DevFS                   11      11       0  100% /dev/deviceFileSystem
/dev/tar-backup/tar-backup
                   346030080 327477939 17392684   95% /c10
+ sleep 10
+ cd /c02/rachome
+ tar cvf - 11.1.0
+ gzip
+ 1> /c10/tar-backup/DB_OH.tar.gz
/tmp/tar[20]: gzip:  not found.
+ su - dbprod -c /tmp/ddd
ttytype: couldn't open /dev/tty for reading
stty: : Not a typewriter
(c)Copyright 1983-2006 Hewlett-Packard Development Company, L.P.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-2000 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993  The Open Software Foundation, Inc.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2006 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
(c)Copyright 1996 Progressive Systems, Inc.

Confidential computer software. Valid license from HP required for
possession, use or copying.  Consistent with FAR 12.211 and 12.212,
Commercial Computer Software, Computer Software Documentation, and
Technical Data for Commercial Items are licensed to the U.S. Government
under vendor's standard commercial license.

You have mail.
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter
                                                                                             Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3    4194304  619432 3546976   15% /
/dev/vg00/lvol1    3145728  319832 2803896   10% /stand
/dev/vg00/lvol8    41943040 29456984 12465504   70% /var
/dev/vg00/lvol7    15728640 3187704 12443000   20% /usr
/dev/vg00/lvol6    5242880   89848 5114816    2% /tmp
/dev/vg00/lvol5    15728640 5982912 9670408   38% /opt
/dev/vg00/lvol4    2097152  851296 1236200   41% /home
/dev/c04/c04       52428800 28381731 22544245   56% /c04
/dev/oravg02/c03   630194176 345826147 266747820   56% /c03
/dev/ORAVG01/c02   141557760 108405173 31383162   78% /c02
/dev/new-c/c01     9437184 7246215 2056288   78% /c01
/dev/app-backup/app-bacup
                   56623104 40885879 14753712   73% /app-backup
DevFS                   11      11       0  100% /dev/deviceFileSystem
/dev/tar-backup/tar-backup
                   346030080 327477939 17392684   95% /c10
+ date +%d%m%Y
+ mv /c10/tar-backup/DB_OH.tar.gz /c10/tar-backup/DB_OH.tar.gz.17062016
prodata1#

i also set my profile ...for example

but its now running....

 

# set term if it's not set

 if [ "$TERM" = "" -o "$TERM" = "unknown" -o "$TERM" = "dialup" \
 -o "$TERM" = "network" ]
 then
 eval `ttytype -s -a`
 fi

 export TERM

if tty -s
then
 eval $(ttytype -sa)
 tabs
 export HISTFILE=${HISTFILE:-$HOME/.sh_history}
 export HISTSIZE=5000
 stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixoff
 stty susp \^Z dsusp \^Y
fi

HISTFILE=/.sh_history; export HISTFILE
HISTSIZE=1000; export HISTSIZE

export PS1="`hostname`#"
umask 022
prodata1#

 

Kindly do the need full....

 

3 REPLIES 3
Highlighted
Honored Contributor

Re: Cron script not running

This is the error:

/tmp/tar[20]: gzip:  not found.

When you run the script from a login, you have an environment set that includes setting $PATH. In that login, gzip can be found without a full path. The tar and pax commands are in the standard location set by cron (ie, /usr/bin) but gzip is in some other directory. To find out where gzip is located, enter this command:

# type gzip

It will report where gzip is found without using a full path.
Change the gzip reference to use the full path such as /usr/local/bin/gzip or wherever gzip is located.

 



Bill Hassell, sysadmin
Highlighted
Regular Advisor

Re: Cron script not running

Hello,

I changed the script file (add full path of tar/pax but still same error

Again same error coming :---

You have mail.
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter
                                                                                                                                   Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3    4194304  619488 3546920   15% /
/dev/vg00/lvol1    3145728  319832 2803896   10% /stand
/dev/vg00/lvol8    41943040 29506376 12416408   70% /var
/dev/vg00/lvol7    15728640 3187704 12443000   20% /usr
/dev/vg00/lvol6    5242880   89872 5114792    2% /tmp
/dev/vg00/lvol5    15728640 5982912 9670408   38% /opt
/dev/vg00/lvol4    2097152  851296 1236200   41% /home
/dev/c04/c04       52428800 32968581 18244066   64% /c04
/dev/oravg02/c03   630194176 425081872 192445579   69% /c03
/dev/ORAVG01/c02   141557760 108504920 31289134   78% /c02
/dev/new-c/c01     9437184 7246215 2056288   78% /c01
/dev/app-backup/app-bacup
                   56623104 40885879 14753712   73% /app-backup
DevFS                   11      11       0  100% /dev/deviceFileSystem
/dev/tar-backup/tar-backup
                   346030080 327477939 17392684   95% /c10
/dev/tar/tar       292552704   88786 274184930    0% /new-tar
+ sleep 10
+ cd /c02/rachome
+ /usr/bin/tar cvf - 11.1.0
+ /usr/contrib/bin/gunzip
+ 1> /new-tar/DB_OH.tar.gz
a 11.1.0/inventory/prereqs/prerequisite.properties 1 blocks
a 11.1.0/inventory/prereqs/db/db_prereq.xml 54 blocks
a 11.1.0/inventory/prereqs/db/dbprereq.jar 381 blocks

gunzip: stdin: not in gzip format
+ su - dbprod -c /tmp/ddd
ttytype: couldn't open /dev/tty for reading
stty: : Not a typewriter
(c)Copyright 1983-2006 Hewlett-Packard Development Company, L.P.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-2000 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993  The Open Software Foundation, Inc.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2006 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
(c)Copyright 1996 Progressive Systems, Inc.

Confidential computer software. Valid license from HP required for
possession, use or copying.  Consistent with FAR 12.211 and 12.212,
Commercial Computer Software, Computer Software Documentation, and
Technical Data for Commercial Items are licensed to the U.S. Government
under vendor's standard commercial license.

You have mail.
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter
                                                                                                                                   Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3    4194304  619488 3546920   15% /
/dev/vg00/lvol1    3145728  319832 2803896   10% /stand
/dev/vg00/lvol8    41943040 29505856 12416928   70% /var
/dev/vg00/lvol7    15728640 3187704 12443000   20% /usr
/dev/vg00/lvol6    5242880   89872 5114792    2% /tmp
/dev/vg00/lvol5    15728640 5982912 9670408   38% /opt
/dev/vg00/lvol4    2097152  851296 1236200   41% /home
/dev/c04/c04       52428800 32968581 18244066   64% /c04
/dev/oravg02/c03   630194176 425081872 192445579   69% /c03
/dev/ORAVG01/c02   141557760 108505153 31288916   78% /c02
/dev/new-c/c01     9437184 7246215 2056288   78% /c01
/dev/app-backup/app-bacup
                   56623104 40885879 14753712   73% /app-backup
DevFS                   11      11       0  100% /dev/deviceFileSystem
/dev/tar-backup/tar-backup
                   346030080 327477939 17392684   95% /c10
/dev/tar/tar       292552704   88786 274184930    0% /new-tar
+ date +%d%m%Y
+ mv /new-tar/DB_OH.tar.gz /new-tar/DB_OH.tar.gz.18062016
prodata1#

 

 

thanks for sonnest response

 

 

Highlighted
Acclaimed Contributor

Re: Cron script not running

>Again same error coming:

>Not a terminal
>stty: : Not a typewriter

 

You need to fix the .profiles of the user of each su(1) you do: dbprod 

 

+ /usr/bin/tar cvf - 11.1.0
+ /usr/contrib/bin/gunzip
+ 1> /new-tar/DB_OH.tar.gz

 

Not sure why you have gunzip here when you had gzip.