a cron problem

a cron problem

Post by mehlw.. » Wed, 31 May 2006 21:18:38



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

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


+ 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

 
 
 

a cron problem

Post by Robert Bono » Thu, 01 Jun 2006 04:24:42




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


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


 
 
 

a cron problem

Post by Mehlwur » Thu, 01 Jun 2006 15:09:24


Quote:

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

maybe that this is the problem .. the only user who is allowed to
access the database is dms ..  when the scirpt is started from cron is
it the user cron?

how can i change the user when i am in the script? (it is an island
system, so i can write the passwd in plain text in the script)

Quote:

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

i added to each directory a chmod 777 and to each file which is
touched, but it still doesnt work
 
 
 

a cron problem

Post by Mehlwur » Thu, 01 Jun 2006 20:12:28


i have done some changes ... and now it looks like

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


/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

 
 
 

a cron problem

Post by Bill Marcu » Thu, 01 Jun 2006 20:54:43


On 31 May 2006 04:12:28 -0700, Mehlwurm

> and there is a new error mail ->

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


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

         sql -f8F79.38 $db < /usr/users/dms/bin/db_tmp_dir/copy.out

/path/to/sql

--
I can't complain, but sometimes I still do.
                -- Joe Walsh

 
 
 

a cron problem

Post by Mehlwur » Fri, 02 Jun 2006 22:59:05


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

the new error

# mail

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


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

? d

i would like to cry ....

 
 
 

a cron problem

Post by Chris F.A. Johnso » Sat, 03 Jun 2006 03:03:18



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

> 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


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

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

> ? d

> i would like to cry ....

  Read the error messages.

  Where is stty being called? It's not in your script, so it is
  probably a shell initialization.

  What is your crontab entry?

  Have you tried:

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

--
   Chris F.A. Johnson, author              <http://cfaj.freeshell.org>
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
   ===== My code in this post, if any, assumes the POSIX locale
   ===== and is released under the GNU General Public Licence

 
 
 

a cron problem

Post by Michael Tosc » Sat, 03 Jun 2006 05:09:45



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

> 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


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

Looks like a csh is trying to execute it, despite the #!/bin/sh

Quote:

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

Haven't followed this thread, sorry.

Is dms the user root should switch to,
and does dms have a csh login shell (passwd entry)?

I think the crontab entry should be

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

or maybe

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

or maybe

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

Assuming that /usr/users/dms/bin/2_secure_script
is the above script, and its very first line is
#!/bin/sh
it should run.

Regarding the script above:

The PATH= and LD_LIBRARY_PATH= lines only have an
effect if you add another line

export PATH LD_LIBRARY_PATH

--

 
 
 

a cron problem

Post by Mehlwur » Sat, 03 Jun 2006 17:49:54


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 !

 
 
 

1. cron.deny and cron.allow files for CRON management

Hi All

I  can not  seem to be able to  make these files  work. Despite  an
entry  in  cron.deny  file,  the  specific user  can use
the crontab  command  to  submit  a  job  to  cron and  the  job
does  gets  executed.
Crontab  command  is  supposed  to check  entries  in these  files.
Ido not think  this is  happening.

Any  idea  will  be  greatly  appreciated.
Please  send  me an e-mail.

Thanks


2. Help needed with Apache and .htaccess

3. Cron Problems - Script runs from shell but not cron

4. flash and java under mozilla

5. cron and visual cron

6. prob with IBM 730MB hd + AHA 1542CF

7. cron, perl, and signals -- cron spins out of control

8. UDP/TCP ports -> protocol port

9. Why doesn't cron run the lp cron file?

10. Help! Cron and Samba / Cron and missing directories?

11. Cron <root@host> run-parts /etc/cron.daily

12. cron listed as /USR/BIN/CRON ???

13. cron.deny and cron.allow ?