Newbie looking for good reference & starting point for project

G

Gregory Mamayek

Good Afternoon:

As silly as this sounds, this is my first time using a newsgroup.

My dilemma is that I don't have a computer science background, nor am I
a programmer. I would like to learn batch programming.

*I am looking for both a good reference for learning batch programming,
& an origin for the ensuing project:*

OBJECTIVE

Transfer 4 logs from Unix SVR to PC using TCP/IP. Then, from PC to
another SVR.

ISSUES

Transferring largest log takes 4 hours during work since 311MB file.
Logs not accessible until EOM, meaning 1st day of next month.
Logs cannot be transferred when backups are taking place.

MANUAL PSFTP (Putty) PROCEDURES

2x click PSFTP icon located at local path
psftp> open ip address
login as: x
x@ip address' password: y
psftp> cd SVR path
psftp> get file local path\file
psftp> exit

I figure that if I can manually transfer the logs using secure FTP, then
I can automate the process with batch processing.

I have played with WIN2K's MS-DOS commands; so I can call the psftp.exe,
but need to learn how to pass in variables to transfer the log files. I
must have the syntax wrong, any suggestions?

I appreciate your assistance in advance.
 
H

Herb Martin

As silly as this sounds, this is my first time using a newsgroup.

Doesn't sound a bit silly -- everyone here had a first time;
and some of us go away for months or even years without
using the newsgroups.
My dilemma is that I don't have a computer science background, nor am I
a programmer. I would like to learn batch programming.

No big deal -- most computer people don't have a computer
science degree or IS/IT degree.

That you wish to learn -- and will expend effort is sufficient.
*I am looking for both a good reference for learning batch programming,
& an origin for the ensuing project:*

Ok, but first -- The ONLY way to learn to program is to WRITE
programs, practice problems and such are fine but you must write
something YOU CARE about so that you have to solve the problems.

First figure out the language you wish to learn -- even "batch" has
dozens of choices these days, (plain DOS batch, VBScript, JScript,
Perl, are just some that work on Win2000.)

Generally the type of problem you have below is best handled
with Perl -- you are working on both Unix and Win2000 and
you need to exercise FTP (or some such transfer); there are
significant libraries that can be cobbled together to do this in
Perl.

Any language will do the job but if you are looking for something
with the least "hard stuff" then Perl gets my vote for this one.

Note you can actually scripts the Win2000 FTP command but
things like error checking etc won't be that easy.
OBJECTIVE

Transfer 4 logs from Unix SVR to PC using TCP/IP. Then, from PC to
another SVR.

ISSUES

Transferring largest log takes 4 hours during work since 311MB file.
Logs not accessible until EOM, meaning 1st day of next month.
Logs cannot be transferred when backups are taking place.

Can they be compressed before transfer? Usually logs compress
quite nicely. I do this with my logs on a script at the server which
runs each night so that by the time I transfer the logs they are ready.
(Compression runs in a LOW-priority process so that it will have
minimal interference with the servers responsiveness.)
MANUAL PSFTP (Putty) PROCEDURES

2x click PSFTP icon located at local path
psftp> open ip address
login as: x
x@ip address' password: y
psftp> cd SVR path
psftp> get file local path\file
psftp> exit

I figure that if I can manually transfer the logs using secure FTP, then
I can automate the process with batch processing.

Yes, in fact if you script THIS, you have already done the first step;
write down all the steps, prompts and replies.

If you "program" it in some other tool, then having this will guide
you to emulate something similar.
I have played with WIN2K's MS-DOS commands; so I can call the psftp.exe,
but need to learn how to pass in variables to transfer the log files. I
must have the syntax wrong, any suggestions?

I don't recognize psftp.exe but the REGULAR built-in FTP.exe
can take input like this:

ftp <script.txt

You put your commands in script.txt (or whatever) and the "input
redirection" (<) sucks that file in instead of you typing.

Try it on something simple (not the 300meg file but another FTP
server and a small file just to see.)
 
H

Herb Martin

Thanx for prompt professional reply. This beats ColdFusion's forums any
day of
the week.

Glad to help.
I would like to do it in native DOS. I'm not going for simple here. I'm going
for knowledge. No hurry with this project.

Ok, in the long run you will get more value and knowledge by
learning both DOS/Cmd Batch AND Perl -- perhaps VBScript
next.
I haven't scripted it yet. I am researching how to do it & expect plenty of
errors.

Just setup an internal test IIS server with FTP (make it internal since
if you are not very experienced or keep up with it there are security
issues).

Put a few files there in the same relative path as your REAL target.

Just try it. Take all those lines YOU TYPE and put them in a text
file -- run your ftp with the redirection switch from that file OR
if that doesn't work, try the FTP.exe on win2000:

ftp TestServer.domain.com <mycommands.txt

Watch the output OR send the output to a file >results.txt
 
G

guard

Gregory Mamayek said:
I would like to learn batch programming.
I am looking for ... a good reference
I'm going for knowledge.

*******

One of the primary skills for a Windows System Admin
is the ability to write reliable and maintainable
shell scripts (aka batch files).

Here are some valuable FREE and "Almost Free"
resources to assist you.

*******
#1 - Write your scripts using Mount/\Commands

..Mount/\Commands are extensions to the "builtin"
commands and utilities that are present on
ALL INSTALLATIONS of all NT-based operating
systems including Windows NT4 SP6a, 2000,
XP and Server 2003.

They are constructed entirely of builtin commands
common to all four platforms (NT/2K/XP/K3).
There is NO BINARY CODE, only scripting commands!

..Mount/\Commands are specifically designed for
use in shell scripts and are coded for
Compatibility, Clarity and Speed.

Compatibility means that ALL M/\Cs perform
CONSISTENTLY across NT/2K/XP/K3. When the
command is created, those aggravating special
cases (the source of much Fuming) are masked
within the M/\C code so a CONSISTENT RESULT is
ALWAYS OBTAINED.

Clarity means that scripting code written
using MountCommands can be easily understood
and maintained, even by those without
extensive scripting experience.

Speed means that all available methods are
employed to enhance the performance of each
command, including preloading the code so
NO DISK ACCESS is needed to invoke it!

The complete Mount/\Command Set contains over 200
of these powerful commands. For more information,
see (http://MountCommands.com).

*******
#2 - Learn structured scripting techniques.

Our Free KnowledgeLetter, "BoomingOrFuming?" provides
valuable knowledge regarding the creation and maintenance
of reliable cross-platform shell scripts. This includes
Pattern Scripts to help you create your own custom
Mount/\Commands to add to the Standard Set.

You can peruse the first seven issues at
(http://BoomingOrFuming.com)

*******
#3 - Get the FREE Advanced NT/2K/XP Command Library (ntlib.cmd)

ntlib.cmd provides over 50 sample Mount/\Commands
to assist with writing and documenting shell scripts.
To get your FREE copy, go to (http://ntlib.com).

*******
You will also want to take a look at TheGuardBook,
Online Reference for Cross-Platform Shell Scripting at
(http://TheSystemGuard.com/GuardBook.asp).

All the commands internal to cmd.exe are documented
here in "Mounted Help" pages. This includes a color-keyed
page highlighting the differences between all
internal commands in NT/2K/XP/K3. The "Common Help"
from each OS's help screen is also available for comparison.

*******

-tsg
____________________________________________________________
TheSystemGuard.com | BoomingOrFuming.com | MountCommands.com
Free and "Almost Free" Knowledge for Windows System Admins!
 
H

Herb Martin

I will play with the commands & ask if I get stuck.
I'm really persistent, figured out how to do LDAP modifications & SSO (Single
Sign On) by myself...trial & error.

Then you will do fine and learn a lot. Don't hesitate to ask,
there isn't much flaming on these groups for newbie questions
-- especially if you make half an effort.
Noted: I have Perl & VBS books for the WWW, but not much help for OS (have
oodles of bookmarks). Just trying to learn one language at a time. I will keep
your option in mind.

Yes, pick one and learn it to a useful state and then learn
another. I am a Perl fan and go back to VB 1.0 beta but
neither of these languages are the best for TEACHING
programming -- except that a beginner can get so much
done in either with just a few statements.

VB shines at GUI stuff but the syntax is clunky -- Perl shines
as massaging data, network stuff, finding patterns, etc, but
is eclectic and it's motto "There's more than one way to do it."
means that beginners have to make decisions for themselves
early on.

But as the REAL Perl guru's say, you can write Perl at many
levels and they won't make fun of you for kindergarten Perl
(I write jr. High perl probably said:
...bows to the great COMMAND PROMPT GODS...
LOL

If I see one I will let him know.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top