- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- expect script - cron and errors..
Operating System - Linux
1824874
Members
3812
Online
109674
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2006 03:04 AM
02-16-2006 03:04 AM
expect script - cron and errors..
All,
I have an expect script that I have that uses
scp to move files from one server to another, it is a transactional thing that I put in cron to run every 15 minutes.. I am getting a message in the mailbox:
CRONTAB LINE:
1,14,30,45 * * * * /usr/local/bin/apphire.sh
MAIL MESSAGE:
spawn /usr/local/bin/scp /tmp/*apphire.txt root@205.202.254.91:/tmp
Executing ssh2 failed. Command:' ssh2 -l root -x -a -o passwordprompt %U@%H's password: -o nodelay yes -o authenticationnotify yes -s sftp' System error message:
'No such file or directory'
send: spawn id exp3 not open
while executing
"send "PASSWORD\r""
(file "/usr/local/bin/appput.exp" line 4)
I can run it manually without error.
APPPUT.EXP
# cat appput.exp
###############################################
#!/usr/local/bin/expect
spawn /usr/local/bin/scp /tmp/*apphire.txt user@:/tmp
expect "user@'s password:"
send "PASSWORD\r"
expect "debug: uninitializing event loop"
send "\r"
###############################################
THIS IS THE SCRIPT THAT INITIATES THE PROCESS
NOTE /usr/local/bin/appput.exp Initiate at the end of the script..
APPHIRE.SH
###############################################
# cat apphire.sh
#!/bin/sh
for dst in `cat /pei/peitools/bin/distid.txt`
do
echo $dst
export D="$dst"
export INFORMIXSERVER=pei
sed s/DIST/"$D"/g /usr/local/bin/apphire.template > /tmp/"$D"apphire.sql
sudo -u support /usr/informix/bin/isql "$D"plus < /tmp/"$D"apphire.sql
done
/usr/local/bin/appput.exp
How would I assure myself the file transfer is completing correctly? Again I can run the file manually and get the following output:
# apphire.sh
arl
0 row(s) unloaded.
blr
0 row(s) unloaded.
con
0 row(s) unloaded.
elk
0 row(s) unloaded.
esu
0 row(s) unloaded.
ftc
0 row(s) unloaded.
grt
0 row(s) unloaded.
mps
12 row(s) unloaded.
plk
0 row(s) unloaded.
plv
61 row(s) unloaded.
raa
0 row(s) unloaded.
raf
0 row(s) unloaded.
ral
0 row(s) unloaded.
val
0 row(s) unloaded.
wat
0 row(s) unloaded.
wsf
0 row(s) unloaded.
wst
0 row(s) unloaded.
spawn /usr/local/bin/scp /tmp/*apphire.txt user@:/tmp
user@'s password:
arlapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
blrapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
conapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
elkapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
esuapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
ftcapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
grtapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
mpsapphire.txt | 336B | 0.3 kB/s | TOC: 00:00:01 | 100%
plkapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
plvapphire.txt | 1.4kB | 1.4 kB/s | TOC: 00:00:01 | 100%
raaapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
rafapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
ralapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
valapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
watapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
wsfapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
wstapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
send: spawn id exp4 not open
while executing
"send "\r"
"
(file "/usr/local/bin/appput.exp" line 6)
Any insights appreciated..
Rex Mueller - Educational Service Unit #3
I have an expect script that I have that uses
scp to move files from one server to another, it is a transactional thing that I put in cron to run every 15 minutes.. I am getting a message in the mailbox:
CRONTAB LINE:
1,14,30,45 * * * * /usr/local/bin/apphire.sh
MAIL MESSAGE:
spawn /usr/local/bin/scp /tmp/*apphire.txt root@205.202.254.91:/tmp
Executing ssh2 failed. Command:' ssh2 -l root -x -a -o passwordprompt %U@%H's password: -o nodelay yes -o authenticationnotify yes
'No such file or directory'
send: spawn id exp3 not open
while executing
"send "PASSWORD\r""
(file "/usr/local/bin/appput.exp" line 4)
I can run it manually without error.
APPPUT.EXP
# cat appput.exp
###############################################
#!/usr/local/bin/expect
spawn /usr/local/bin/scp /tmp/*apphire.txt user@
expect "user@
send "PASSWORD\r"
expect "debug: uninitializing event loop"
send "\r"
###############################################
THIS IS THE SCRIPT THAT INITIATES THE PROCESS
NOTE /usr/local/bin/appput.exp Initiate at the end of the script..
APPHIRE.SH
###############################################
# cat apphire.sh
#!/bin/sh
for dst in `cat /pei/peitools/bin/distid.txt`
do
echo $dst
export D="$dst"
export INFORMIXSERVER=pei
sed s/DIST/"$D"/g /usr/local/bin/apphire.template > /tmp/"$D"apphire.sql
sudo -u support /usr/informix/bin/isql "$D"plus < /tmp/"$D"apphire.sql
done
/usr/local/bin/appput.exp
How would I assure myself the file transfer is completing correctly? Again I can run the file manually and get the following output:
# apphire.sh
arl
0 row(s) unloaded.
blr
0 row(s) unloaded.
con
0 row(s) unloaded.
elk
0 row(s) unloaded.
esu
0 row(s) unloaded.
ftc
0 row(s) unloaded.
grt
0 row(s) unloaded.
mps
12 row(s) unloaded.
plk
0 row(s) unloaded.
plv
61 row(s) unloaded.
raa
0 row(s) unloaded.
raf
0 row(s) unloaded.
ral
0 row(s) unloaded.
val
0 row(s) unloaded.
wat
0 row(s) unloaded.
wsf
0 row(s) unloaded.
wst
0 row(s) unloaded.
spawn /usr/local/bin/scp /tmp/*apphire.txt user@
user@
arlapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
blrapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
conapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
elkapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
esuapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
ftcapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
grtapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
mpsapphire.txt | 336B | 0.3 kB/s | TOC: 00:00:01 | 100%
plkapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
plvapphire.txt | 1.4kB | 1.4 kB/s | TOC: 00:00:01 | 100%
raaapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
rafapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
ralapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
valapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
watapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
wsfapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
wstapphire.txt | 0B | 0.0 kB/s | TOC: 00:00:01 | 100%
send: spawn id exp4 not open
while executing
"send "\r"
"
(file "/usr/local/bin/appput.exp" line 6)
Any insights appreciated..
Rex Mueller - Educational Service Unit #3
- Tags:
- expect
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2006 02:17 AM
02-20-2006 02:17 AM
Re: expect script - cron and errors..
moved to sysadmin because of Cron issue
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP