Re: a cron problem
- From: bonomi@xxxxxxxxxxxxxxxxxxxx (Robert Bonomi)
- Date: Tue, 30 May 2006 19:24:42 -0000
In article <1148991518.682611.324990@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<mehlwurm@xxxxxxxxxxxxxx> wrote:
Hi,
I have trouble with a cron job, which should save a database.
I wrote a script (attached) and it works, if I start it, but if cron
wants to start it I get the .tar.gz file but it is just 176KB and not
5000KB :-(
I don´t know where the problem can be ... have asked in many forums
and
a lot of people ... i hope you can help me ...
*read* the error messages in the cron output.
They say that the job "cannot open" various files.
this is a 'file access permissions' problem.
What 'user' is the cron job running as?
What 'groups', if any is that user a member of?
What are the permissions on the _directory_ those files (the ones that
cannot be opened) are in? What are the permissions on every other
directory in the path, all the way up to the root directory?
If you _still_ haven't found anything, are any of the directories in
the path 'mount points' for filesystems? If so, *unmount* the filesystem,
and check the access permissions on the underlying directory.
the script:
<<<<
#!/bin/ksh
# In der Datei "liste" sind die zu sichernden DB's anzugeben ### in
liste are the names of the DB
#
set -x
cd /usr/users/dms/bin
dir=`pwd`
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
cd db_tmp_dir
/usr/users/dms/bin/copydb -c $db
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 *
chmod 777 $tar
gzip -9 $tar
mv "$tar".gz /usr/users/dms/backup/BY_CRON
cd ..
rm -rf db_tmp_dir
done
env
exit
copydb is a binary, which works and is available
i m using a true64
the error mail looks like:
<<<<
mgodms51> mail
Received: by mgodms51 id k4IAf0e101791; Thu, 18 May 2006 10:41:00 GMTFrom root Thu May 18 10:41:00 2006
Date: Thu, 18 May 2006 10:41:00 GMT
From: system PRIVILEGED account <root@mgodms51>
Message-Id: <200605181041.k4IAf0e101791@mgodms51>
+ cd /usr/users/dms/bin
+ + pwd
dir=/usr/users/dms/bin
+ cat liste
+ + date +%d%h%y_%H%M
tar=krhlive_by_cron_18May06_1040.tar
+ rm -rf db_tmp_dir
+ mkdir db_tmp_dir
+ cd db_tmp_dir
+ /usr/users/dms/bin/copydb -c krhlive
+ sql -f8F79.38 krhlive
+ /usr/users/dms/bin/2_secure_script[29]:
/usr/users/dms/bin/db_tmp_dir/copy.out: cannot open
+ pwd
+ sed s+/usr/users/dms/bin/db_tmp_dir+.+
+ /usr/users/dms/bin/2_secure_script[30]:
/usr/users/dms/bin/db_tmp_dir/copy.in: cannot open
+ mv /usr/users/dms/bin/db_tmp_dir/new_copy.in
/usr/users/dms/bin/db_tmp_dir/copy.in
mv: rename /usr/users/dms/bin/db_tmp_dir/new_copy.in to
/usr/users/dms/bin/db_tmp_dir/copy.in: No such file or directory
+ tar -cf krhlive_by_cron_18May06_1040.tar *
tar: * : No such file or directory
+ chmod 777 krhlive_by_cron_18May06_1040.tar
+ gzip -9 krhlive_by_cron_18May06_1040.tar
+ mv krhlive_by_cron_18May06_1040.tar.gz /usr/users/dms/backup/BY_CRON
+ cd ..
+ rm -rf db_tmp_dir
+ + date +%d%h%y_%H%M
tar=trainer_by_cron_18May06_1040.tar
+ rm -rf db_tmp_dir
+ mkdir db_tmp_dir
+ cd db_tmp_dir
+ /usr/users/dms/bin/copydb -c trainer
+ sql -f8F79.38 trainer
+ /usr/users/dms/bin/2_secure_script[29]:
/usr/users/dms/bin/db_tmp_dir/copy.out: cannot open
+ pwd
+ sed s+/usr/users/dms/bin/db_tmp_dir+.+
+ /usr/users/dms/bin/2_secure_script[30]:
/usr/users/dms/bin/db_tmp_dir/copy.in: cannot open
+ mv /usr/users/dms/bin/db_tmp_dir/new_copy.in
/usr/users/dms/bin/db_tmp_dir/copy.in
mv: rename /usr/users/dms/bin/db_tmp_dir/new_copy.in to
/usr/users/dms/bin/db_tmp_dir/copy.in: No such file or directory
+ tar -cf trainer_by_cron_18May06_1040.tar *
tar: * : No such file or directory
+ chmod 777 trainer_by_cron_18May06_1040.tar
+ gzip -9 trainer_by_cron_18May06_1040.tar
+ mv trainer_by_cron_18May06_1040.tar.gz /usr/users/dms/backup/BY_CRON
+ cd ..
+ rm -rf db_tmp_dir
+ env
PATH=:/usr/bin
LOGNAME=dms
USER=dms
SHELL=/usr/bin/sh
HOME=/usr/users/dms
PWD=/usr/users/dms/bin
+ exit
*************************************************
Cron: The previous message is the standard output
and standard error of the following crontab command:
/usr/users/dms/bin/2_secure_script
?
please help me !!!
many thanks
Mehlwurm
.
- Follow-Ups:
- Re: a cron problem
- From: Mehlwurm
- Re: a cron problem
- References:
- a cron problem
- From: mehlwurm
- a cron problem
- Prev by Date: Problem with variable
- Next by Date: Re: Problem with variable
- Previous by thread: a cron problem
- Next by thread: Re: a cron problem
- Index(es):
Relevant Pages
|