Re: cron and ssh

From: Greg M Lee (greg_at_ncs.co.nz)
Date: 07/30/04


Date: Fri, 30 Jul 2004 13:00:18 +1200

Chad Lemmen 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
>
> debug1: Sending command: cat parseshell/price.prn
> debug1: channel request 0: exec
> debug1: channel 0: open confirm rwindow 0 rmax 32768
> debug1: channel_free: channel 0: client-session, nchannels 1
> debug1: fd 0 clearing O_NONBLOCK
> debug1: fd 1 clearing O_NONBLOCK
> debug1: fd 2 clearing O_NONBLOCK
> 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
>
> What does 'select: Invalid argument' mean? Is there something wrong with
> my syntax that cron doesn't like? Why does the command work if typed
> at the command line or if the script is run manually, but doesn't
> work with cron?

Hi
  I can't help you with the error but using scp may help ie replace
the first command with:
  scp linuxhost:parseshell/price.prn /path_on_sco/price.prn

  It also might not help as scp uses ssh to do the transfer :-(

-Greg
[ I have seen a similar error running rsync from cron under RHEL 3
  syncing from the SCO box to the Linux one, although in my case the
  error happens at the end of the rsync transfer ]



Relevant Pages

  • Re: Rexx SSH and Cron
    ... Cron does not set an environment above the default. ...  This is useful if ssh is ... On the command line they both work, ...
    (comp.lang.rexx)
  • ssh not ending (sometimes) from inside a script, why?
    ... Okay I have this script file that runs from cron job (on a unix box ... three ssh commands I have in the script just doesn't know it's done ... The ssh command has executed. ...
    (comp.security.ssh)
  • Re: Problems with scp and cron
    ... cron used another ssh than me and could not read my ssh2 private key file. ... > debug1: Connection established. ...
    (comp.security.ssh)
  • Re: Run a command in SSH shell (and close SSH but keep command running)
    ... I don't cron this because the ... Use shell ... This will bring up a separate terminal in which you can run ssh or whatever ... The command will keep running. ...
    (alt.os.linux)
  • Re: Rexx SSH and Cron
    ... Cron does not set an environment above the default. ... supposed to run the command. ... used when ssh is run in the background. ...
    (comp.lang.rexx)