Re: a cron problem



Mehlwurm wrote:
the new script

-------------------------
#!/bin/sh






##########################################
## ##
## Scirpt zum Sichern von DB's ##
## ##
##########################################
## ##
## Autor: M. Wilke ##
## Datum: 31.05.2006 ##
## Version: 1.5 ##
## ##
##########################################
#
# In der Datei "liste" sind die zu sichernden DB's anzugeben
#






PATH=/usr/dbms/ingres/lib:/sbin/loader:/usr/users/dms/bin:/sbin:/usr/sbin:/usr/opt/jre142/bin:/usr/bin:/usr/bin/X11:/usr/ucb:/usr/local/bin:/usr/local/install/bin:/usr/dbms/ingres/bin:/usr/dbms/ingres/utility:/usr/users/dms/tools:.
II_SYSTEM=/usr/dbms
LD_LIBRARY_PATH=/lib:/usr/dbms/ingres/lib
cd /usr/users/dms/bin






for db in `cat liste`
;
do
tar=""$db"_by_cron_`date +%d%h%y_%H%M`.tar"
rm -rf db_tmp_dir
mkdir db_tmp_dir
chmod 777 db_tmp_dir

we already told you that chmof 777 is a bad habit, didn't we ?

cd db_tmp_dir
/usr/users/dms/bin/copydb -c $db
/usr/dbms/ingres/bin/sql -f8F79.38 $db <
/usr/users/dms/bin/db_tmp_dir/copy.out
sed "s+`pwd`+.+" < /usr/users/dms/bin/db_tmp_dir/copy.in >
/usr/users/dms/bin/db_tmp_dir/new_copy.in
mv /usr/users/dms/bin/db_tmp_dir/new_copy.in
/usr/users/dms/bin/db_tmp_dir/copy.in
tar -cf $tar *
I already told you that 'tar cf file.tar *' is a bad habit (google for 'glob' or ARGV_MAX) , use 'tar cf file.tar .'
instead.


chmod 777 $tar
gzip -9 $tar
mv "$tar".gz /usr/users/dms/backup/BY_CRON
cd ..
rm -rf db_tmp_dir
done
exit
---------------------------------------

the new error

# mail
From root Thu Jun 1 12:56:01 2006
Received: by vfedms id k51Cu1715875; Thu, 1 Jun 2006 12:56:01 GMT
Date: Thu, 1 Jun 2006 12:56:01 GMT
From: system PRIVILEGED account <root@vfedms>
Message-Id: <200606011256.k51Cu1715875@vfedms>



Warning: no access to tty; thus no job control in this shell...
stty: tcgetattr: Not a typewriter
stty: tcgetattr: Not a typewriter
Not a terminal

Some program (that you did not show) tries to do a 'su',
which requires a terminal (which the cron job does not have)

PATH=/usr/dbms/ingres/lib:/sbin/loader:/usr/users/dms/bin:/sbin:/usr/sbin:/usr/opt/jre142/bin:/usr/bin:/usr/bin/X11:/usr/ucb:/usr/local/bin:/usr/local/install/bin:/usr/dbms/ingres/bin:/usr/dbms/ingres/utility:/usr/users/dms/tools:.:
Command not found.
II_SYSTEM=/usr/dbms: Command not found.
LD_LIBRARY_PATH=/lib:/usr/dbms/ingres/lib: Command not found.
for: Command not found.
do: Command not found.
db: Undefined variable.

This is probably caused by a wrong shell-setting.
put a set -x, or a "set; env;" in your script to find out the current settings.



logout






*************************************************
Cron: The previous message is the standard output
and standard error of the following crontab command:



su - dms /usr/users/dms/bin/2_secure_script

something tried to su.
what does your crontab looks like ?
On who's account is it executed ?
Also the '-' is dubious, (it attempts to act like a login shell, more or less)
Don't attempt to run non-root cronjobs as root.
It is not needed, and can only screw up things.



? d

i would like to cry ....

You'd better learn to read.

Good luck,

HTH,
AvK

.



Relevant Pages

  • Re: a cron problem
    ... for db in `cat liste` ... tar -cf $tar * ... for: Command not found. ... Regarding the script above: ...
    (comp.unix.shell)
  • Re: a cron problem
    ... for db in `cat liste` ... tar -cf $tar * ... for: Command not found. ... The previous message is the standard output ...
    (comp.unix.programmer)
  • Re: a cron problem
    ... for db in `cat liste` ... tar -cf $tar * ... for: Command not found. ... The previous message is the standard output ...
    (comp.unix.shell)
  • Re: a cron problem
    ... for db in `cat liste` ... tar -cf $tar * ... stty: tcgetattr: Not a typewriter ... for: Command not found. ...
    (comp.unix.shell)
  • usb2 port gets very slow on 2-gig Flash Drive.
    ... I needed to reload the flash drive on a Zenstone 2-gig mp3 ... It is July 24 and ps ax -Olstart shows me that tar has ... several minutes between the rm -r -f command to wipe the FAT ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)