Solved

!sleep in ftp ?Invalid command

Posted on 2008-11-01
5
4,151 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
ID: 22859364
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
ID: 22859555
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
ID: 22861491
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
ID: 22862672
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
ID: 31512385
Thank you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

914 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

14 Experts available now in Live!

Get 1:1 Help Now