TotalNET Advanced Server 5.2 Reference Manual

Chapter 6 NetWare Login Scripts

NetWare login commands process login scripts. You can write a server-wide login script in the file net$log.dat under the public directory of the sys volume. Users may have user-specific login scripts in their mail directory in the sys volume, named after the user ID numbers. The login program processes the user-specific login script, if it exists, after it processes the server-wide login script. Use the TAS-supported "edscript""edscript program or the NetWare syscon program to create, access, and modify both server-wide and user-specific login scripts.

The server ignores blank lines in login scripts. All other lines must begin with one of the commands listed in the "Login Program" section. You can use all of these entries in both the server-wide and user-specific login scripts. You need to know notational conventions and identifier variables to write login scripts:

Notational Conventions

  1. In a NetWare path statement, the server sees no difference between a slash (/) and a backslash (\).

  2. You may replace any path variable with a drive letter, volume name, directory, or subdirectory, as appropriate, in the following format:


    {drive|volume}:/dir/
  3. Include full path specifications unless you know a short one will suffice.

  4. All commands and variables have case-insensitivity.

  5. All commands end when you press Enter. Some commands in this document continue to a second line. If you type a command in syscon, it wraps to the next line. Do not press Enter to start the second line; if you do, login sees it as a new command.

Identifier Variables

Format each identifier variable in upper-case and precede it with a percent sign (%).

DAY 

day number (from 01 to 31) 

DAY_OF_WEEK 

day name (from Sunday to Saturday) 

MONTH 

month number (from 01 to 12) 

MONTH_NAME 

month name (from January to December) 

NDAY_OF_WEEK 

weekday number (from 1 to 7; 1=Sunday) 

SHORT_YEAR 

last two digits of year (96, 97, and so on) 

YEAR 

all four digits of year (1996, 1997, and so on) 

AM_PM 

part of day (AM or PM) 

GREETING_TIME 

time of day (morning, afternoon, evening) 

HOUR 

hour in 12-hour scale (from 1 to 12) 

HOUR24 

hour in 24-hour scale (from 00 to 23) 

MINUTE 

minutes (from 00 to 59) 

SECOND 

seconds (from 00 to 59) 

FULL_NAME 

user's full name 

LOGIN_NAME 

user's login name 

MEMBER OF group 

user's assigned group 

NOT MEMBER OF group 

group to which user does not belong 

USER_ID 

number assigned to user for mail and other directories 

FILE_SERVER 

server name 

NETWORK_ADDRESS 

network number of the cabling system (8-digit hexadecimal) 

DOS_REQUESTER 

version of the DOS NetWare shell (1.02, 2.x, 3.x, 4.x) 

MACHINE 

type of computer (IBM-PC) 

OS 

type of DOS on the workstation (MSDOS, DR DOS) 

P_STATION 

workstation's Ethernet address (12-digit hexadecimal) 

SHELL_TYPE 

version of the DOS NetWare shell (1.02, 2.x, 3.x, 4.x), same as DOS_REQUESTER 

SMACHINE 

short name for computer type (IBM) 

STATION 

PC connection number 

%n 

nth parameter of command line 

variable 

DOS environment variable, such as <path> 

Enclose in angle brackets. To use variable in a map command, insert a percent sign in front of the variable, as in map s5:=%<WP>. 

Login Program

TAS's login.exe file processes the subset of Novell's NetWare login scripts commands. In login scripts, the variable %0 always refers to the current server name, and the variable %1 always refers to the current user name. Other parameters on the command line reference as %2 through %9.

The TAS login utility cannot run all login scripts that can run under Novell's NetWare login utility. TAS only supports utilities for DOS VLM/NETX clients.

The login program also has the following options:

/Script filename 

Overrides the system and user login scripts, processing the file name instead. 

/Noattach 

Invokes login scripts without logging out of the current server. 

/Clearscreen 

Clears the screen as soon as the user types the password. 

You can also use the TAS PC client utility login to log in to a NetWare server. For more information, see Chapter 5, Client Utilities.

This section covers the following commands:

#

This command executes a program external to the login script. Include command parameters as needed, just as when you execute such a command from the DOS command line. Command control returns to the login script after the external command executes.

Usage

# [path] filename [parameter]

Options

path 

Specify the path to the file. 

filename

Specify the base name of a file with a .bat, .com, or .exe extension. You need not include the extension unless two files with the same base name reside in the same directory. 

parameter 

Specify the command parameter. 

Examples

  1. Use the following command to verify the system time:


    # time
  2. Use the following command to redirect a printer port to a network print queue:


    # capture q=laser
  3. Use the following command to run a batch file to check your "to do" list:


    # sys:/home/janet/todo.bat

attach

This command connects a client to another server.

Usage

 attach [servername[\username]]
 attach ident_var

Options

servername 

Specify the name of a remote server. It defaults to the user name for the current server. 

username

Specify a valid user name at servername. 

Examples

  1. Use the following command to attach to the server called support as the current user name:


    attach support
  2. Use the following command to attach to the server called support as user name pierce:


    attach support\pierce

break

This command enables or disables termination of login script execution. A break entry does not affect the DOS break state.

Usage

break {on|off}

Options

on 

Enable the option to terminate execution of the script by pressing Control-p or Control-c at any point after the break on entry and before a break off entry, if included. The server does not save type-ahead keyboard input in the keyboard buffer when you use this option. 

off 

Disable the option to terminate execution of the script. If you set break to off, you cannot set it back to on. 

Examples

  1. Use the following command to enable the option to terminate execution of the script by pressing Control-p or Control-c at any point after the break on entry and before a break off entry:


    break on
  2. Use the following command to disable the option to terminate execution of the script:


    break off

comspec

This command specifies the directory where the DOS command.com command processor resides. A user can run DOS from a network directory by mapping a search drive in the login script to that directory and adding the comspec entry. Be sure comspec points to the same version of command.com as the client uses when it boots.

Usage

comspec=[path]command.com

Option

path 

Specify the path to command.com. 

Example

Use the following command to specify /tmp/ as the directory where command.com resides:

comspec=/tmp/command.com

display

This command displays a text file on the screen when a user logs in.

Usage

display [path]filename

Options

path 

Specify the path to the file. 

filename 

Specify the name of the file you want to display. 

Example

Use the following command to diplay the text file begin.txt at /tmp when a user logs in:

display /tmp/begin.txt

DOS break

This command sets or overrides the state of the DOS break check.

Usage

DOS break {on|off}

Options

on 

Enable termination of program executions other than login script commands by pressing Control-p or Control-c. 

off 

Disable termination of program executions other than login script commands, the default. If you set DOS break to off, you cannot set it back to on. 

Examples

  1. Use the following command to enable termination of program executions other than login script commands:


    DOS break on
  2. Use the following command to disable termination of program executions other than login script commands:


    DOS break off

DOS verify

This command verifies that data copied by the DOS copy command copies accurately. If you use the /v option with each DOS copy command, or if you use Novell's ncopy command, you do not need to use this command.

Usage

DOS verify {on|off}

Options

on 

Ensure that the DOS copy command verifies data during each copy so you do not have to use copy /v or ncopy. 

off 

Cause the DOS copy command not to verify data during each copy, the default. 

Examples

  1. Use the following command to ensure that the DOS copy command verifies data during each copy so you do not have to use copy /v or ncopy:


    DOS verify on
  2. Use the following command to cause the DOS copy command not to verify data during each copy:


    DOS verify off

drive

This command specifies the default drive.

Usage

drive drive:

Option

drive 

Specify a drive letter. This option defaults to your first network drive, usually assigned to the login directory. 

Example

Use the following command to specify the D drive as the default drive:

drive D:

exit

This command terminates execution of the login program and, if you wish, executes an external program. Using exit at the end of the system login script prevents user login scripts from executing. On termination of the command, control does not return to the script.

In some cases, you can use exit in an if...then entry to terminate the script. If you do, use exit on a separate line.

Usage

exit ["command"]

Option

command 

Terminate the script and execute the command. 

Example

Add the following entry to the end of user richard's login script to cause his client to remind him every Thursday to do his status report:

if day_of_week = "thursday" then exit "edit
 	s:/richard/status.txt"

fire phasers

This command emits a sound.

Usage

fire phasers n times

Option

Specify the number of times, from 1 to 9, that you want the sound to emit. 

Example

Use the following command to fire the phasers two times during login on every day except Friday and fire them five times on Friday:

if day_of_week = "friday" then fire phasers 5 times
else fire phasers 2 times
end

goto

This command, similar to the DOS goto batch command, alters the normal sequence of script command processing. The goto command does not work with if statements.

Usage

goto label

Option

label 

Specify the location to which the point of control transfers in the login script. The label must exist elsewhere in the script on a line by itself, followed by a colon and nothing else. Do not include duplicate labels or use goto to go to a point within an if loop. 

Example

Use the following command to specify A as the location to which the point of control transfers in the login script:

goto A

if...then

This command executes one or more commands under specified conditions. You may nest if...then statements within other if...then statements up to nine levels deep.

Usage

if condition [and|or [condition]] then 
	command
	[command]
[else]
	[command]
	[command]
[end]

Options

condition 

Specify a conditional clause or equation involving any of the identifier variables listed in "Identifier Variables""Identifier Variables. Enclose condition equation values in quotation marks. You may use the following operators in conditional equations:

= "equals" 

<> "does not equal" 

> "is greater than" 

>= "is greater than or equal to" 

< "is less than" 

<= "is less than or equal to" 

and 

Specify all of the surrounding conditional clauses. Use commas to separate conditions in three-part conditional clauses 

or 

Specify one of the surrounding conditional clauses. Use commas to separate conditions in three-part conditional clauses 

command 

Specify a login script command that you want to execute if circumstances meet the specified condition. Place consecutive commands in the then portion on separate lines. 

else 

Restrict the instances of the if...then statement. If you only specify one command after else, the end statement becomes optional. This option must occupy its own line. 

end 

Conclude the if...then sequence. If you specify only one command after the else or if the if...then statement only consists of one logical line, the end statement becomes optional. The end statement must occupy its own line. In a nested if...then statement, end applies only to the current level. Use end for every level that requires it. 

Note

The DOS environment variable does not work properly as a condition for an if statement for the TAS login.exe program.

Example

Use the following sequence to map q:=nwsolaris/sys:/public/q&a to members of the support group, terminate the login script on Saturdays and Sundays, send the message "You spend 1/7 of your life on Monday. Have a nice day. :-)" on Mondays, send the message "Department meeting at 10:00." to members of the support group on Fridays with an alert of three sounds, and send the message "Happy birthday, Levi!" on October 29:

if member of support then map q:=nwsolaris/sys:/public/q&a
if day_of_week = saturday or day_of_week = sunday then exit
if day_of_week = monday then write You spend 1/7 of your life on Monday.\nHave a nice day. :-)
end
if day_of_week = friday then
if member of support then
write Department meeting at 10:00."
fire phasers 3 times
pause
end
end
if month = "10", day = "29", and login_name = "levi" then write "Happy birthday, Levi!"

include

This command, similar to the DOS call batch command, executes a sub-script from within the login script. Sub-scripts can only contain commands valid in login scripts, including other login scripts. You can use any text editor or word processor to create and edit subscripts, as long as you save the files in text-only format.

You may nest sub-scripts as memory allows. When a sub-script completes execution, control returns to the script that called it. You must have at least "read" access to the subscript.

Usage

include [path]filename

Options

path 

Specify the path to the sub-script file. 

filename 

Specify the name of the sub-script file. 

Example

Use the following command to execute the sub-script monday.bat at c:\ in an if...then login script:

if day_of_week = "monday" then include c:\monday.bat

machine

This command sets the DOS machine name of the client PC, since some applications require the PC to have a name. You may also set the machine name in the PC's net.cfg file.

Usage

machine = name

Option

name 

Specify the DOS machine name of the client PC. Use no more than 15 characters. 

Example

Use the following command to set the DOS machine name of the client PC to cinnebar:

machine = "cinnebar"

map

This command redirects, or "maps", drives to network directories.

Usage

map display {on|off}
map errors {on|off}
map [root] [ins] drive:=path
map drive:=drive:
map n path
map del drive:

Options

map display {on|off} 

Specify whether drive mappings display on-screen as they map during login. This usage defaults to display on. 

map errors {on|off} 

Specify whether drive mapping errors display on-screen as they map during login. This usage defaults to map errors off. 

map [root] [ins] drive:=path 

Map a drive to a network directory. 

root 

Make path the virtual root of drive. Use this if you do not want users to access directories above path or if an application expects to find files in a certain relation to the root of a drive. 

ins 

Insert path into the DOS PATH environment variable. 

drive 

Specify any valid local or network drive letter or search drive number. You can also use the letter s followed by the number n, where n represents the desired position in your search path for the path. This also assigns the next available drive letter to the mapping, starting with Z and working backward. 

path 

Specify the name of server and the volume, or the drive letter and the full directory path on the drive or server. This specification defaults to the current server. 

map drive:=drive: 

Temporarily map a local drive, typically a drive letter such as F or G, to a network directory. You cannot access the local drive until you delete the mapping. 

map n path 

Map the next available network drive to the server, volume, and directory specified in path. 

map del drive: 

Delete a map from a local drive. 

Examples

  1. Use the following command to display drive mappings on-screen as they map during login:


    map display on
  2. Use the following command to keep drive mappings from displaying on-screen as they map during login:


    map display off
  3. Use the following command to display drive mapping errors on-screen as they map during login:


    map errors on
  4. Use the following command to keep drive mapping errors from displaying on-screen as they map during login:


    map errors off
  5. Use the following command to map the D drive to the /tmp directory:


    map D:=/tmp
  6. Use the following command to map local drive E to the directory /objects:


    map E:=/objects:
  7. Use the following command to delete the map from the local drive F:


    map del F:

pause

This command, similar to the DOS pause batch command, temporarily stops execution of the script. Use pause to give the user time to read a message before it scrolls off the screen. The message Strike any key when ready... appears on the screen. The next keyboard input resumes execution of the script.

Usage

pause

Example

Use the following command to temporarily stop execution of the script:

pause

remark

This command inserts explanatory remarks in the script.

Usage

rem [text]
remark [text]
* [text]
; [text]

Options

rem, remark, *, ; 

Insert an explanatory remark. These designations must occur at the beginnings of lines. 

text 

Type the text you want to insert. Login ignores this option; the text does not appear on-screen. 

Example

Use one of the following commands to insert the remark "Double-check this sequence.":

rem Double-check this sequence.
remark Double-che
ck this sequence.
* Double-check this sequence.
; Double-check this sequence.

set

This command, similar to the DOS set command, declares a value for a DOS environment variable.

Usage

[temp] set varname = "value"

Options

temp 

Change the environment variable for just the duration of the login script execution. 

varname 

Specify the name of the environment variable that you want to create or change. 

value 

Specify the value you want to give the variable. Note that unlike the DOS set command, you should enclose it in double quotation marks. 

Example

Use the following command to change the value the environment variable file to value doc.txt for only the duration of the login script execution:

temp set file = "doc.txt"

shift

This command changes the login command parameters referenced by %n variables in the script. With the login command, the login script can refer to the server name and user name as %0 and %1. You can include other parameters on the command line, referring to them as %2, %3, and so on.

Usage

shift [n]

Option

Specify the number of shifts to the left you want to make on a reference to a command line parameter, from 0 to 9. This option defaults to 1. 

Example

Use the following command to make one shift left to a reference to the command line parameter:

shift 1

write

This command displays messages during login. text represents the message to display on the screen. Include applicable identifier variables or any of the commands in Options table.

Usage

 write text

Option

text 

The message you want to display. Include any of the following options: 

\r -- Carriage return. 

\n -- New line. 

\" -- Embedded quotation mark. 

\7 -- Beep sound. 

; -- Join. 

Example

Use the following command to greet a user:

 write Good %GREETING_TIME, %LOGIN_NAME