Re: cron and ssh
From: Chad Lemmen (chadl_at_lemmen.com)
Date: 07/30/04
- Previous message: Stuart J. Browne: "Re: cron and ssh"
- In reply to: Stuart J. Browne: "Re: cron and ssh"
- Next in thread: Chad Lemmen: "Re: cron and ssh"
- Reply: Chad Lemmen: "Re: cron and ssh"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 30 Jul 2004 02:01:38 GMT
Stuart J. Browne <stuart@promed.com.au> wrote:
>
>>
>> I'm running SCO 5.0.5 and I'm having trouble getting cron to work with
> ssh.
>> I have openssh 3.4p1 installed and setup so that I can access a Linux box
>> without being prompted for a password. Here is the script I'm having
> cron
>> run
>>
>> #!/bin/sh
>> PATH=/usr/local/bin:$PATH
>> ssh linuxhost cat parseshell/price.prn >> /path_on_sco/price.prn ;
>> ssh linuxhost rm parseshell/price.prn
>>
>>
>> This script works if I execute it manually, but not if I have cron run
> it.
>> cron doesn't have a problem with the second ssh line
>> 'ssh linuxhost rm parseshell/price.prn' that works with no errors, but
>> I'm getting an error with the first ssh line. Cron emails me this
>>
>> select: Invalid argument
>> debug1: Transferred: stdin 0, stdout 0, stderr 26 bytes in 0.0 seconds
>> debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 272696336.3
>> debug1: Exit status -1
>>
>
> My thought would be to cut try cutting off STDIN, as it doesn't exist, and
> try again:
>
> ssh -n linuxhost "cat parseshell/price.prn;rm parseshell/price.prn" >>
> /path_on_sco/price.prn
>
What you have above works on the command line, but cron doesn't like it.
Cron gives me the same error "select: Invalid argument" an empty file is
appended to /path_on_sco/price.prn, but it's not getting the data from
the cat command run on the Linux box.
I can get it to work using the three commands below, but it would be nice
to do it in just one command like you have above.
#!/bin/sh
scp linuxhost:parseshell/price.prn price.prn
cat price.prn >> /path_on_sco/dtnprice.prn
ssh linuxhost 'rm parseshell/price.prn'
- Previous message: Stuart J. Browne: "Re: cron and ssh"
- In reply to: Stuart J. Browne: "Re: cron and ssh"
- Next in thread: Chad Lemmen: "Re: cron and ssh"
- Reply: Chad Lemmen: "Re: cron and ssh"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|