Your LOGIN.COM File

You will probably come to appreciate your LOGIN.COM file as a very valuable feature of OpenVMS as it can handle many tedious tasks and save many keystrokes. You use it to customize your OpenVMS environment, define custom commands, or perform other tasks automatically.

When you log into the system, OpenVMS locates the command procedure LOGIN.COM in your home directory and executes it automatically.

Note 

Your system manager may configure your account to use some file other than LOGIN.COM or none at all, but this is rare. Additionally, most systems have a systemwide procedure—SYLOGIN.COM—that is automatically executed by all users before LOGIN.COM is executed. Your system manager maintains SYLOGIN.COM.

Any commands you wish to execute each time you log in should be placed in your LOGIN.COM file. This may include commands to set up any software you use, the creation of symbols and logical names, or whatever else you desire.

For example, the author's LOGIN.COM assigns some command symbols, defines some logical names, performs setups for other software, such as language compilers, checks the amount of free space on disks, sets terminal characteristics, and checks the system for any device errors that may have occurred.

Aside from its automatic execution, LOGIN.COM is a normal command procedure in all respects and can be modified by any ordinary text editor. (See the sections on command procedures, symbols, logical names, and text editors elsewhere in this book.)

Here is a very simple LOGIN.COM to illustrate some possible uses.

    $ !    $ ! A simple LOGIN.COM procedure.    $ ! This procedure is executed automatically whenever    $ ! its owner logs into the system.    $ !    $ ! The following line will cause LOGIN.COM to exit    $ ! without performing any work if this is a BATCH,    $ ! DETACHED, or NETWORK login.    $ !    $ if f$mode() .nes. "INTERACTIVE" then $ exit    $ !    $ ! The following commands will be executed when    $ ! the user logs onto the system interactively.    $ !    $ ! Set my terminal to insert rather than    $ ! overstrike mode.    $ !    $ set terminal/insert    $ !    $ ! Define some command symbols    $ !    $ del*ete :== delete/confirm/log    $ dsd     :== directory/size=all/date=modified    $ !    $ ! See how much of my disk-space quota I've used    $ !    $ show quota    $ !    $ exit 

Keep in mind that a login does not mean only that a user logs in interactively at a terminal. Logins also include the initiation of batch jobs and processes created by OpenVMS to provide network services (e.g., FTP and POP3). These types of logins may not need all the functions your LOGIN.COM provides. In this case, executing LOGIN.COM would only waste time.

The example procedure above contains as its first non-comment line the following:

    $ if f$mode() .nes. "INTERACTIVE" then $ exit 

This line uses the f$mode() lexical function to discontinue the execution of LOGIN.COM for anything other than interactive logins (see Chapter 6 "The Digital Command Language", "Lexical Functions" and Chapter 9, "Command Procedures").

In many instances, non interactive logins can safely skip any commands you may have in LOGIN.COM, but there are exceptions. Suppose you have created a command procedure that uses symbols defined in LOGIN.COM in the place of DCL commands. Skipping LOGIN.COM would cause those symbols not to be recognized while in BATCH mode.

To avoid such problems, you may wish to use a format similar to the following for your own LOGIN.COM:

    $ if f$MODE() .EQS. "INTERACTIVE" then $ goto INTER_ONLY    $ if f$MODE() .EQS. "BATCH" then $ goto BATCH_ONLY    $ if f$MODE() .EQS. "NETWORK" then $ goto NETWORK_ONLY    $ if f$MODE() .EQS. "OTHER" then $ goto OTHER_ONLY    $ !    $ INTER_ONLY:    $ !(commands appropriate to INTERACTIVE mode)    $ goto ALL_MODES    $ !    $ BATCH_ONLY:    $ !(commands appropriate to BATCH mode)    $ goto ALL_MODES    $ !    $ NETWORK_ONLY:    $ !(commands appropriate to NETWORK mode)    $ goto ALL_MODES    $ !    $ OTHER_ONLY:    $ !(commands appropriate to OTHER mode)    $ goto ALL_MODES    $ !    $ ALL_MODES:    $ !(commands appropriate for all modes)    $ exit 

Preventing LOGIN.COM from Running

You may prevent LOGIN.COM from running during a login, or specify a different command procedure to run in its place. This is helpful if you have made some mistake in LOGIN.COM and would like to log in without executing it.

To do so, append the /[NO]COMMAND qualifier to your username while logging in:

    Username: JONES                  Use LOGIN.COM by default    Username: JONES/COMMAND=ALT.COM  Uses ALT.COM rather than LOGIN.COM    Username: JONES/NOCOMMAND        Prevents any procedure from running 

The system wide login procedure SYS$MANAGER:SYLOGIN.COM (or another file as specified by your system manager) will be executed even if you use /NOCOMMAND during login.



Getting Started with OpenVMS(c) A Guide for New Users
Getting Started with OpenVMS: A Guide for New Users (HP Technologies)
ISBN: 1555582796
EAN: 2147483647
Year: 2005
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net