General discussion

Locked

Solaris 2.6: 1) running ftp from shell s

By gruzglin ·
Sorry forthese simple questions:

1. I need to automate my daily file upload
through an ftp session.

Is there any way to supply a password
to the standard ftp client from UNIX
shell script ?

I also found some tips (ftp man page)
as to how to use .netrc file for
ftp 'autologin' mode. However it does
not seem to work either... at least
I cannot find how to force ftp into
this autologin mode.

I would highly appreciate any help.

2. I am looking for Sun Solaris 2.6
commands which can provide some
statistics regarding memory usage,
paging/swapping, disk and network I/O.

Thanks in advance,

Jerry.

This conversation is currently closed to new comments.

21 total posts (Page 1 of 3)   01 | 02 | 03   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Solaris 2.6: 1) running ftp from shell s

Hi!

This is the link you need for question number two.

http://www.sunfreeware.com/

In the frame to the right click on the OS version and architecture you are running.

Then in the lower right frame scrol down and look for a program calledtop.

Download and use pkg tools to install.
This program will give info about a by you specified number of running process and their mem, cpu utilization as well as user, group, id and such.

At the top program will disply total memore usage, cpu utilization by system and users, swap utilization and a few others.

Search around that site and you probably find something similiar for the network.

As for your first question I use ncftp instead.

With ncftp you'll get a few batch scripting programs such as ncftpget, ncftpput, ncftpls...

Checkout:
http://www.ncftp.com/

for more info and download of both sources and binaries.

Click the link for clients and get version 3.0.1.

/Hasse

Collapse -

Solaris 2.6: 1) running ftp from shell s

by gruzglin In reply to Solaris 2.6: 1) running f ...

The question was auto-closed by TechRepublic

Collapse -

Solaris 2.6: 1) running ftp from shell s

by debbie.lynn In reply to Solaris 2.6: 1) running f ...

In answer to question 1.

Firstly create a .netrc file in the users home directory, Ensure the file is owned by the user and the permissions are 600.

The entry within the .netrc should be as follows:-

machine {remote machine name} login {login name} password {passwd}

Within your shell script you then issue the ftp command using the following:-
ftp -i << EOF
put {filename}
EOF

Hope this helps...

Collapse -

Solaris 2.6: 1) running ftp from shell s

by gruzglin In reply to Solaris 2.6: 1) running f ...

The question was auto-closed by TechRepublic

Collapse -

Solaris 2.6: 1) running ftp from shell s

by debbie.lynn In reply to Solaris 2.6: 1) running f ...

In answer to question 2.

You will also be able to see these stats real time using "sar". Look in man pages for list of commands.

Collapse -

Solaris 2.6: 1) running ftp from shell s

by gruzglin In reply to Solaris 2.6: 1) running f ...

The question was auto-closed by TechRepublic

Collapse -

Solaris 2.6: 1) running ftp from shell s

by ustutz In reply to Solaris 2.6: 1) running f ...

For the ftp question: You do not need an ".netrc" file:

From cron - or where ever - execute:

ftp -i -n < script.file

script.file contains:

open host1

user myname mypassword

put /path1/file1
put /path2/file2
mput /path3/file*

close
quit

ftp command options: "-i" disables interactive prompting - needed for the mput/mget commands. "-n" disables 'auto login', i.e., no interactive prompting for username / password.

Collapse -

Solaris 2.6: 1) running ftp from shell s

by gruzglin In reply to Solaris 2.6: 1) running f ...

The question was auto-closed by TechRepublic

Collapse -

Solaris 2.6: 1) running ftp from shell s

by spepper In reply to Solaris 2.6: 1) running f ...

1)requires appropriate .netrc file

#!/bin/sh
# ftper - ftps the file named in second parameter to the machine named in the
# first parameter. renames the file to the name given in the third parameter
# requires an appropriate entry in .netrc
# Usage: ftper machine localfile remotefile username
if [ $# -lt 4 ] ; then
echo "Usage: ftper machine localfile remotefile username"
else
SOURCE=$1
FILE=$2
NEWFILE=$3
USER=$4
#start of ftp session
ftp $SOURCE <<EndFTP put $FILE
rename $FILE $NEWFILE
EndFTP
#end of ftp session

Collapse -

Solaris 2.6: 1) running ftp from shell s

by gruzglin In reply to Solaris 2.6: 1) running f ...

The question was auto-closed by TechRepublic

Back to Linux Forum
21 total posts (Page 1 of 3)   01 | 02 | 03   Next

Related Discussions

Related Forums