Solved

!sleep in ftp ?Invalid command

Posted on 2008-11-01
5
4,082 Views
Last Modified: 2013-12-27
I have this scripts that seems to be working because I can see the files being trnsferred, but I don't know why in the /var/mail/oracle there are messages as if some commands are wrong;

The  script that is being excuted by another script with the at now <  command is int the "Cde Snippet" and the oracle cron outpu is the following.
I wonder why this messages and how to make it error free.

Your "at" job on proddb
"/var/spool/cron/atjobs/1225545781.a"

produced the following output:

?Invalid command
Local directory now /proddb/ora6/STARPROD/arc
Interactive mode off.
/usr/bin/sh: !sleep: not found




> more autoftp
 

ftp <ip address>

!sleep 60

lcd /proddb/ora6/STARPROD/arc

prompt off

cd /oradata/WHSEVZW/u03/STARPROD

!sleep 5

bin

!sleep 5

mput *.Z

!sleep 240

quit

Open in new window

0
Comment
Question by:LindaC
  • 3
5 Comments
 
LVL 22

Accepted Solution

by:
blu earned 400 total points
Comment Utility
Are you sure it is working? In general, you can't just put sub-commands to a command in a script and have it work. To do that, you need a redirect to tell the shell that the just of the script is supposed to be input to the FTP:

ftp <ip-addr> <<EOF
!sleep 60
lcd /proddb/ora6/STARPROD/arc
prompt off
cd /oradata/WHSEVZW/u03/STARPROD
!sleep 5
bin
!sleep 5
mput *.Z
!sleep 240
quit
EOF

ALso, any outout is mailed to the user, even if everything works okay. If you want to avoid that,
change the ftp line to:

ftp <ip-addr> > /dev/null <<EOF
0
 
LVL 8

Author Comment

by:LindaC
Comment Utility
I changed the script and included the  <<EOF, so I will wait a while to see how it goes.
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 100 total points
Comment Utility
If this is running as a crontab job then you need to put the full path name

!/usr/bin/sleep 60

How authentication is done?
0
 
LVL 8

Author Comment

by:LindaC
Comment Utility
Authentication is being done by .netrc with a chmod of 600.

But I think blu has the answer as the error has not shown again:

Your "at" job on proddb
"/var/spool/cron/atjobs/1225615694.a"

produced the following output:

Local directory now /proddb/ora6/STARPROD/arc
Interactive mode off.


Waiting for any additional comments to award the points.
0
 
LVL 8

Author Closing Comment

by:LindaC
Comment Utility
Thank you.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now