Feedback Search Top Backward Forward
EDM/2

OS/2 Routes - PPP Automation

Written by Tom Brown

Linkbar

 

Topic

This month I will share an assortment of automation techniques. This will include a fully automated PPP connection.

Automation

Application scheduling is typically the heart of an automation effort. Once tasks can be performed by executing a single command, the next step is to schedule these tasks to run at the appropriate times and intervals. I have been using a cron clone with good success.

A tremendous level of automation can be achieved using very simple techniques and a few utilities. For convenience, I have included some batch files and utilities which I have written to help ease the task of automating connections and batch jobs. Also, here is a list of other utilities which my utilities may require, or I may just find useful.


at.cmd         - will delay the execution of a command until the specified time
do.cmd         - execute a command the specified number of times
every.cmd      - execute a command at specified intervals
while.cmd      - execute a command while an error condition persists
wait.cmd       - execute a command after a specified period of time
schedule.cmd   - run all command files in the given directory

fileUpdate.cmd - will copy drive:\path\file.new to drive:\path\file
reboot.cmd     - will reboot the system by calling SETBOOT
watchDogUp.cmd - kill a process after a specified period of time
watchDogDn.cmd - bring down a running watchdog

ftpGet.cmd     - fetch a file using ftp from the command line
getSites.cmd   - an example of using ftpGet.cmd
IAP.cmd        - Internet Access Point (PPP server)
ISPUp.cmd      - Calls IAP.cmd
IPMon.cmd      - Monitors
loopback.cmd   - Configures the loopback interface
nistime.cmd    - Calls nistime.exe with the appropriate parameters to allow it
                 to run unattended
ping.cmd       - Extends the convenience of the enhanced ping application

Batch Files

This group of batch files can be used as a basis of implementing your own automation scripts to fulfill your own needs. Most of these are self evident and those which aren't can be easily understood by looking at the script itself.

Download source

Note that file pairs named similar to subsystemUp and subsystemDn are used for starting and stopping subsystems. I find this a handy convention for scheduling the start and stop of systems such as mail, news servers, daemons, etc.

To handle batch PPP connections, I use the PPPConnectUp and PPPConnectDn commands. Have a close look at these. They call the PPP driver with parameters that are appropriate for my service provider. Note that PPPConnectUp will test to see if a connection is already present before it builds a new one. Thus it can be run without worry of killing a current connection. Security is described in detail by pppdoc.zip listed in the utilities section of this document. I will not rewrite this material at this time, of course if there were sufficient requests, I could try to explain this in a future column.

Look at the file 'morningProcess.cmd'. This will give you an idea of the level of automation on my system. I can read mail, fetch/send news, fetch/send files and even backup my system to a remote server, totally offline. The possibilities are endless.

The SCHEDULE.CMD command requires that a schedule directory be created. This will be the parent to the group directories which lay below it. This directory should be placed in the 'dir' variable at the top of SCHEDULE.CMD. By using SCHEDULE.CMD, I am able to serialize the running of groups of jobs. Running Network related files serially allows each command to have the full network bandwidth and avoids congestion which might cause session failures in an extreme case. If you look at GETSITES.CMD, you will see that I fetch the file lists from a couple of FTP servers and store them locally. If I want a file that is contained in one of the file lists, I would simply create a 'getFile.cmd' batch file which calls 'ftpGet.cmd' to fetch my file. I would put this file into the 'Once' directory. This way, in the early hours of the morning when my machine connects and runs its jobs, the file is fetched and the job will then be archived so that it doesn't run again (a special property of the 'Once' directory).

Utilities

The batch files above require many of the applications in these archives:


// cron scheduler
ftp://hobbes.nmsu.edu/os2/unix/cron214.zip

// enhanced ping
ftp://hobbes.nmsu.edu/os2/unix/ping.zip

// syslog facility
ftp://hobbes.nmsu.edu/os2/unix/syslog2b.zip

// kill process by name
ftp://hobbes.nmsu.edu/os2/unix/kill21.zip

// PPP documentation (WARP v4.0 users will have this online)
ftp://hobbes.nmsu.edu/os2/network/tcpip/pppdoc.zip

// Update time/date from NIST Internet server
ftp://hobbes.nmsu.edu/os2/network/tcpip/nistime.zip

Next Column

Good luck with automating your system. This group of command files and utilities should enable most users achieve the results they desire. Feel free to let me know if this information is not sufficient and I will look at expanding on it in next month's column.

 

Linkbar