on 07-29-2010 1:18 PM
I have a problem with a cronjob. When I started the script "recover_dbmcli.sh" with the user-id p01adm, the script running succesfully.
But when i started the same script with the crontab, the script started; but the dbmcli-command was not running
The crontab was edited with the same user-id p01adm.
simple example:
p01adm: crontab -e
30 13 * * * touch /tmp/recover_cron_ok ; cd /home/p01adm/ ; ./recover_dbmcli.sh ;
-
Script recover_dbmcli.sh:
#!/bin/bash
dbmcli -U c -i /home/p01adm/restore2.txt
exit 0
-
restore2.txt:
db_admin
> Script recover_dbmcli.sh:
>
> #!/bin/bash
> dbmcli -U c -i /home/p01adm/restore2.txt
> exit 0
Hmm.. at least the last line would be a bug to me... this covers all errors and nobody ever will notice.
> restore2.txt:
>
> db_admin
Hmm... without any loginformation I'd just assume that the user account under which the cron daemon runs lacks permssions or something like that.
How about using the -l <logfile name> switch or redirecting the output to a file ( >> filename) ?
regards,
Lars
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lars,
thanks for your fast answer. I redirecting the output to a file , but this file is empty.
#!/bin/bash
dbmcli -U c -i /home/p01adm/restore2.txt >> /tmp/log.txt
exit 0
-rw-rr 1 p01adm sapsys 0 2010-07-29 15:10 recover_cron_ok
-rw-rr 1 p01adm sapsys 0 2010-07-29 15:10 log.txt
best regards
volker
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> I have a problem with a cronjob. When I started the script "recover_dbmcli.sh" with the user-id p01adm, the script running succesfully.
> But when i started the same script with the crontab, the script started; but the dbmcli-command was not running
Did you explicitly source the environment? Cron does not do that automatically. So you'd have to start your script such as
#!/bin/csh
#
source $HOME/cshrc
source $HOME/.dbenv_<hostname>.csh
etc.
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.