hasn318
1
Hello,
I am trying to run a script through crontab and it runs the first time and then it does not run.
I tried to run a simple script (as shown below) and I see the same issue.
#!/bin/ksh
clear
echo "Good Morning, World." > /tmp/test123
Crontab Entry:
30 09 * * * /home/uhosting/test > /tmp/test123 2>&1
Any advise/comments, please?
hasn318
3
In the script or in the crontab?
apmcd47
4
In the crontab. And get rid of the one in the script!
Andrew
ctsgnb
5
Up to you, but avoid to update them both at the same time (i updated my previous post).
hasn318
6
Thanks for the inputs, that works. Now the script that I have issue, I am trying to logon to a remote server and get a listing from a directory.
ssh -q servername 'ls -al /nim/dr/mksysb/*|grep _dr|cut -c37-90|cut -d" " -f2-8|cut -d_ -f1' > /tmp/output
the above command works fine from the command line but not through crontab
apmcd47
7
At this point I'm guessing ssh keys. You probably need to explicitly include the private key file you are using:
ssh -q -i /home/myname/.ssh/id_dsa ...
assuming the identity file is the id_dsa file.
What are you trying to get from the server? Do you have stat
on the server? Could you use that to find the file information you are looking for?
Andrew
RudiC
8
Is it possible that the commands are not found due to missing environment?
I did a echo $SHELL and added it to $PATH
RudiC
10
That might be insufficient. All commands must be reachable via the $PATH
variable.