vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? |
| |||
| 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 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 ] |
| |||
| "Chad Lemmen" <chad@naboo.lemmen.com> wrote in message news:GsgOc.42186$qT3.28947@nwrddc03.gnilink.net... > > 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? 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" >> /path_on_sco/price.prn There should also be nothing stopping you combining these two ssh commands into one either: ssh -n linuxhost "cat parseshell/price.prn;rm parseshell/price.prn" >> /path_on_sco/price.prn Quoting the command string makes for eaiser reading/understanding later as well. Give it a shot, see how it goes. bkx |
| |||
| 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 cat price.prn >> /path_on_sco/dtnprice.prn ssh linuxhost 'rm parseshell/price.prn' |
| ||||
| Chad Lemmen <chadl@lemmen.com> wrote: > 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 > cat price.prn >> /path_on_sco/dtnprice.prn > ssh linuxhost 'rm parseshell/price.prn' I'm getting the "Select: invalid argument" error with the above commands also, but the transfer does work so I guess that error has nothing to do with the problem. Some more testing has revealed this ssh linuxhost 'cat parseshell/price.prn' >> /path_on_sco/dtnprice.prn The above works on the command line. If I use the -n option on the command line then /path_on_sco/dtnprice.prn is an empty file after running the command. ssh -n linuxhost 'cat parseshell/price.prn' >> /path_on_sco/dtnprice.prn The -n option on ssh prevents reading from stdin. Now when cron runs the script it doesn't matter if I used the -n option or not stdin is not read. I think for this command to work I need stdin to be read so I guess it just won't work with cron? |