Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I write this script? 2

Status
Not open for further replies.

penguin1

IS-IT--Management
Mar 5, 2001
15
US
Code:
I need to write a script for our HP-UX server that allows an end-user to do the following:

[b]1. Login using FTP [/b][i](without having to type the login and password -- I'd like this built into the script, if possible). [b]NOTE:  End-user will be starting out at an MS-DOS session within Windows 98[/b][/i]
[b]2. Be prompted for a date to search for
3. Have the script search a directory for a file that has that date in the format of YEAR/MONTH/DAY
4. Then GET that file from the directory
5. Log the end-user out (QUIT)[/b]


I'm new to UNIX, so I'm having trouble figuring out how to "hide" the login stuff and prompt the user (as well as search for the file and GET it).  Please let me know if you can help.  Thanks!
 
You're about SOL. There are some products for Windows that allow scripting, however, the best way would be for the user to use the UNIX side to transfer the files. Since the user is using Windows 98, there is no FTP server, so the best out is using FTP Explorer or WSFTP pro or another WIN tool and the user will just have to login. That's what security is for.
 
Just install samba.
You can download it, Its free and it works.
Your HP box will be seen as an NT server on the net.
You can share printers and give permisions etc...

Gregor.Weertman@mailcity.com
 
I think you need to write your script on the Win98 side. I have passed the options for ftp. In your script when you ftp you can pass a file that has the user id and password. This isn't the most secure way to do things, but it will get around the end user doing the typing.

check the help for ftp on win98. Here is a sample of how that script might work.

ftp -n -v -s:ftpfile
ftpfile looks like:
open hostname
user
jdejoe01
password
cd /tmp
get volheader
quit

I ftp suppressing prompts and passing the ftpfile,
the ftpfile says what host to connect to, issues the user
command, passes the user id, passes the user's password
change directory to /tmp
get the file volheader
quit the session.

Hope this helps.
 
Ok here is the ... script.
With this batch you can copy multiple files at ones.
Don't put a space between yourusername, yourpasswd and the > sign.


@echo off
echo open nnn.nnn.nnn.nnn > c:\tmp\aa1234
echo yourusername>> c:\tmp\aa1234
echo yourpasswd>> c:\tmp\aa1234
echo ascii>> c:\tmp\aa1234
rem echo binary>> c:\tmp\aa1234
:get
echo get %1 >> c:\tmp\aa1234
shift
if "%1" == "" goto ftp
goto get
:ftp
echo bye >> c:\tmp\aa1234
ftp -s:c:\tmp\aa1234
del c:\tmp\aa1234

Gregor.Weertman@mailcity.com
 
HP includes an application called CIFS on its 11.0 installation disks. That is their version of Samba and it includes much better doc than any of the Samba versions you can download for free. I'd use that. Your users can drag and drop files easily and file security on the Unix side is enforced.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top