niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » Tru64
a cron problem
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
mehlwurm@rocketmail.com
*nix forums beginner


Joined: 30 May 2006
Posts: 17

PostPosted: Fri Jun 02, 2006 8:51 am    Post subject: Re: a cron problem .. know working Reply with quote

in /var/spool/cron/crontabs/root

00 2 * * * su dms -c /usr/users/dms/bin/2_secure_script


das Script:

#!/bin/sh
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
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 *
chmod 777 $tar
gzip -9 $tar
mv "$tar".gz /usr/users/dms/backup/BY_CRON
cd ..
rm -rf db_tmp_dir
done
exit


funktioniert


THX an alle !
Back to top
mehlwurm@rocketmail.com
*nix forums beginner


Joined: 30 May 2006
Posts: 17

PostPosted: Wed May 31, 2006 11:15 am    Post subject: Re: a cron problem Reply with quote

i have done some changes, but it still doesnīt work :-(

-=start of the new scipt=-

more 2_secure_script
#!/bin/sh

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

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
chmod 777 db_tmp_dir
cd db_tmp_dir
touch copy.out
touch copy.in
touch new_copy.in
chmod 777 copy.in
chmod 777 copy.out
chmod 777 new_copy.in
/usr/users/dms/bin/copydb -c $db
chmod 777 copy.in
chmod 777 copy.out
chmod 777 new_copy.in
sql -f8F79.38 $db < /usr/users/dms/bin/db_tmp_dir/copy.out
chmod 777 copy.in
chmod 777 copy.out
chmod 777 new_copy.in
sed "s+`pwd`+.+" < /usr/users/dms/bin/db_tmp_dir/copy.in >
/usr/users/dms/bin/db_tmp_dir/new_copy.in
chmod 777 copy.in
chmod 777 copy.out
chmod 777 new_copy.in
mv /usr/users/dms/bin/db_tmp_dir/new_copy.in
/usr/users/dms/bin/db_tmp_dir/copy.in
chmod 777 copy.in
chmod 777 copy.out
chmod 777 new_copy.in
tar -cvf $tar .
chmod 777 $tar
gzip -9 $tar
mv "$tar".gz /usr/users/dms/backup/BY_CRON
cd ..
rm -rf db_tmp_dir
done
exit

-=end of the new scipt=-

and there is a new error mail ->

Quote:
From root Wed May 24 11:25:04 2006

Received: by mgodms51 id k4OBP3q144193; Wed, 24 May 2006 11:25:03 GMT
Date: Wed, 24 May 2006 11:25:03 GMT
From: system PRIVILEGED account <root@mgodms51>
Message-Id: <200605241125.k4OBP3q144193@mgodms51>

/usr/users/dms/bin/2_secure_script[34]: sql: not found
/usr/users/dms/bin/2_secure_script[34]: sql: not found

*************************************************
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


THX
Back to top
mehlwurm@rocketmail.com
*nix forums beginner


Joined: 30 May 2006
Posts: 17

PostPosted: Tue May 30, 2006 1:06 pm    Post subject: a cron problem Reply with quote

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 ...

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
Quote:


copydb is a binary, which works and is available
i m using a true64
the error mail looks like:
<<<<
mgodms51> mail
Quote:
From root Thu May 18 10:41:00 2006
Received: by mgodms51 id k4IAf0e101791; Thu, 18 May 2006 10:41:00 GMT

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

?
Quote:

please help me !!!




many thanks



Mehlwurm
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Wed Dec 03, 2008 10:07 pm | All times are GMT
navigation Forum index » *nix » Tru64
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Unknown in header problem -SOLVED- Light Speed Postfix 0 Thu Jul 03, 2008 10:40 am
No new posts problem with sending mail nuxia Postfix 0 Mon Apr 21, 2008 3:58 am
No new posts Postfix 2.3.8 Virtual problem Blotto Postfix 0 Fri Apr 04, 2008 6:11 am
No new posts Postfix sending problem for local domain remote email monkey_magix Postfix 0 Mon Sep 10, 2007 10:17 am
No new posts bounce problem murkis Postfix 0 Sun Oct 08, 2006 3:45 pm

Company Reports | Personal Injury Lawyer Los Angeles | WoW Gold | Credit Cards | Credit Cards
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.4665s ][ Queries: 20 (0.3755s) ][ GZIP on - Debug on ]