65
Introduction to OSS Module 1

Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

Embed Size (px)

Citation preview

Page 1: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

Introduction to OSS

Module 1

Page 2: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 2

What Is OSS?

� NonStop Kernel Open System Services

� API, command interpreter, and utilities

� HP NonStop system implementation of POSIX open standards

� Familiar interface and capabilities on top of NonStop system fundamentals

Page 3: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 3

Characteristics of Open Systems

� Compatibility — Applications running on the system will be able to run on future versions of the system.

� Portability — Applications running on the operating system on a given hardware platform will run on any vendor’s system that utilizes that same operating system.

� Scalability — Applications written for the system will run on the full range of computer architectures and sizes.

� Interoperability — Applications running on the system will be able to communicate with any other system using the same networking protocols.

Page 4: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 4

Program

POSIX.1 APIs

POSIX.1 (API examples)

� abort — Generate an abnormal process abort

� alarm — Schedule an alarm

� clock — Report processor time used

� cos — Cosine function

� execv — Execute a file

� exit — Terminate a process

� free — Free memory

� pause — Suspend process execution

� stat — Get file status

� time — Get system time

Page 5: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 5

POSIX.2 Commands

POSIX.2 (command examples)

� cat — Concatenate and print files

� cp — Copy files

� date — Get the date and time

� grep — Search a file for a pattern

� ls — List directory contents

� man — Display manual pages

� rmdir — Remove a directory

Page 6: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 6

Commands and Utilities(POSIX)

Base Profile

C (ISO and Common Usage)

Internationalized System Calls and Libraries

(POSIX)

Operating System and Languages

ADAPascalFORTRANCOBOL

X/OPEN XPG4

Page 7: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 7

What OSS Is Not

� UNIX

� Similar but different

� POSIX

� OSS is more than just this

� A development environment

� Facilities exist, but there are better ways

Page 8: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 8

OSS Versus UNIX

� Which UNIX?

� SVR4 versus BSD

� Whose UNIX?

� HP-UX

� Solaris

� AIX

� Like UNIX, but different

� No UNIX kernel

� No UNIX system administration

� Only Korn shell

� ...

Page 9: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 9

Products that Use OSS

� HP NonStop TUXEDO

� iTP WebServer

� HP Pathway/iTS

� HP NonStop SQL/MX

� HP NonStop CORBA

� All Java products

� HP NonStop SOAP

� Open Source Software ported to Open System Services (OSS):

� Apache

� Perl

� TCL

� and more ...

Page 10: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 10

Guardian Environment

Database Management

Systems Management

SNA,X25,TCP/IP

Pathway

Database Management

Systems Management

DCE/TCP/IPTUXEDO

Guardian Services

Guardian UtilitiesGuardian APIs

OSS UtilitiesOSS APIs

Application

Open System Svcs

OSS Environment

NonStop Kernel

NonStop Kernel Environments

Page 11: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 11

NonStop Kernel

Guardian API

250+ Functions

POSIX.1/XPG4 API

250+ Functions

150+ C Functions

POSIX.2/XPG4 Tools and Utilities

Guardian Services

Tools and Utilities

TACL

Open System Services

Processes

File systemI/O

Pipes/FIFOsSignals

l18N (L10N)

OSS Product Features

Page 12: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 12

3

1

Guardian API OSS API

GuardianProcess

OSSProcess

GuardianObjects

4

OSSObjects

2

Interoperability with Guardian Environment

1. Access to Guardian services from OSS processes

2. Access to OSS services from Guardian processes

3. Accessing Guardian files

4. Accessing OSS files and objects

Page 13: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 13

OSS/Guardian Interoperability

� Terminals/TELNET session

� Common user ID scheme

� TACL/shell bridge

� Access to /G objects

� Access to /E objects

� Process status display

� Print job spooling

� File attribute display

Page 14: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 14

OSS Environment

� Differences for Guardian users:

� File system

� Commands and utilities

� Access by means of TCP/IP, FTP, or NFS

� Aliasing of spooler locations

� Differences for UNIX users:

� System administration

� Not “vanilla” (plain) UNIX

� Use of OSS and Guardian sockets

Page 15: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

OSS File System Basics

Module 2

Page 16: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 16

Getting In and Out

� Logged in directly

� With TELNET

Available Services:

OSS TACL EXIT

Enter Choice> oss

login:

� Initiated from TACL with OSH1> osh

Page 17: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 17

OSS Shell (Based on Korn Shell)

� Shell environment

� /etc/profile, $HOME/.profile

� Aliases

� Functions

� Command line and history editing

� HP extensions

� DEFINE facilities

� Built-in run command

� -W flags

Page 18: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 18

OSS File System

� File system characteristics

� Hierarchical file system with path names

� Capability to span multiple disk volumes

� Single file limited to one disk volume

� OSS path names

� Case-sensitive (1023 character maximum)

� Access to Guardian files in the /G directory

� Access to remote files on other nodes by means of the /E directory

Page 19: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 19

OSS Hierarchy

/E

/G etc usr var

dev tmp users bin

/

Nodes

Guardian

tty,null

profile

benbill

.profile fileA dirB

vi

Page 20: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 20

Guardian filenames and OSS files

OSS Name Server Application Disk Process Disk volume

OSS Pathname

/usr/tandem/test

Guardian Filename

$VOL.ZYQ00000. Z0000D03

Page 21: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 21

File System Terminology

� Fileset — Subtree of files in the OSS filename space

� Pathname — A character string pointing to a file

� Absolute pathname — A pathname that begins with a slash (/)

� Relative pathname — A pathname that does not begin with a slash (/)

� File name — Guardian file name

� File descriptor — (fd)

� Guardian file number — (fnum)

� File system

Page 22: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 22

OSS Pathname

� Made up of one or more component directory names separated by slashes (/)

� Can be up to 1023 bytes in length; each component can be up to 255 bytes in length

� Component name can be any string of ASCII characters, except null (‘\0’) and slash (/)

� Can be absolute or relative; for example:

� /home/stu01/program.c

� program.c

� Tilde (~) is home directory

� Dot (.) is current directory

� Two dots (..) mean “one level up”

� The names of hidden files begin with a dot (.)

Page 23: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 23

OSS Pathname to Guardian Files (1 of 2)

� /G directory for local files

� Disk: /G/<volume>[/<subvolume>[/filename]]

� <volume> has no leading $

� Subvolume and filename have _ - . removed

� Filename is truncated to eight characters

� Examples:$DATA.PERSONEL.EMPLOYEE is accessed as/G/DATA/PERSONEL/EMPLOYEE

/G/DATA/PERSONEL/EMPL_MAST becomes$DATA.PERSONEL.EMPLMAST

/G/DATA/MY-SUB/MY.FILE becomes$DATA.MYSUB.MYFILE

� Other devices and processes: /G/<proc>

� Same character removal and length restrictions as for disk files

$ZVPT is accessed as /G/ZVPT

Page 24: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 24

OSS Pathname for Guardian Files (2 of 2)

� /E directory for remote systems

� Remote passwords needed

� /E/<system-name>

� <system-name> has no leading \

� /E/<system-name>/G

� Examples:

\REMOTE.$DATA.MYSUB.AFILE is accessed as

/E/REMOTE/G/DATA/MYSUB/AFILE

Page 25: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 25

C

OSS pathname:/filename/filename/………./filename

(dir) (dir)

� Regular disk file

� Text file

� Object file

� Data file

� Directory file

� FIFO (named pipe) file

� Special character file

� Link (hard/symbolic) file

� Sockets file for an AF_UNIX socket

OSS File Types

Page 26: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 26

OSS Security Uses POSIX Security Model

Default permissions preset for any file type

� Directory file: U=rwx G=rwx O=rwx

� Other file types: U=rw- G=rw- O=rw-

� r=read, w=write, x=execute

� U=User (file owner access)

� G=Group (file Group association access)

� O=Other (file access for other than U and G)

Page 27: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 27

Some Common Directories

� /usr — Contains standard subdirectories:

� /usr/include — Header files for compilation

� /usr/lib — Library files for linking

� /usr/tandem — Optional products

� /bin — Standard utilities

� /bin/unsupported — Unsupported utilities

� /users — Contains subdirectories for individuals

� /dev — Two entries only:

� tty — The current terminal session

� null — Standard bit bucket

� /etc — System files

Page 28: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 28

/dev Directory

� The /dev directory (device directory) contains:

� tty — The current controlling terminal

� null — A data sink

� Other devices

� Do not appear in /dev

� Are added and configured in the Guardian environment

Page 29: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 29

… …

/E/riddlr/G/data/test/foo

usr bin

WORK

DATA

TEST

Volume

Subvolume

File ID

G

SPOOLSYSTEM

\RIDDLR.$DATA.TEST.FOO

/

DUMP

OSS File System

E

/G/data/test/foo $DATA.TEST.FOO

RIDDLR

System

/

Page 30: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 30

file and tty Commands

� The file command displays the file type of OSS and Guardian files

� The file command displays:

� File type of OSS and Guardian

� Attributes such as:

� File type

� File code

� Target execution environment

� The tty command displays terminal session name

Page 31: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

Basic Commands and Utilities

Module 3

Page 32: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 32

Functionally Equivalent OSS Commands for Guardian Users

� Navigating to directories

� cd versus VOLUME

� Displaying directories

� ls and ls -l versus FILES and FILEINFO

� Copying files

� cp versus FUP DUP

� Editing files

� vi (and ed) versus TEDIT and EDIT

� Printing files

� lp and lpstat versus FUP COPY and PERUSE

Page 33: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 33

alias cpio fold lp ps trar csplit gencat lpstat pwd trueawk cut genxlt ls read ttybasename date getconf make rm typebc dc getopts man rmdir umaskbg diff grep mkcatdefs sed unaliasc89 dirname head mkdir sh unamecancel echo iconv mkfifo sleep uncompresscat ed id more sort unexpandcd egrep ipcrm mv split uniqchgrp env ipcs nm strings uudecodechmod expand jobs nohup strip uuencodechown expr join od stty vicksum false kill passwd tail waitcmp fc lex paste tar wccomm fg ln pathck tee whocommand fgrep locale pax test xargscompress file logger pr time yacccp find logname printf touch zcat

Commands and Utilities

Page 34: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 34

cd and pwd Commands

� cd command:

� Positions to different directory

� Uses absolute or relative pathname:

� $ cd /usr/tandem/webserver

� $ cd terry/test

� $ cd .. go up one level

� $ cd - go to previous directory

� Position to home directory:

� $ cd

� $ cd ~

� pwd command displays current directory:

� $ pwd

Page 35: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 35

ls Command

� List OSS and Guardian files

� Lists names of OSS files

� Lists names of /G files

� -l flag for details

� -a flag for hidden files

� -r for reverse order

� -t for modified timestamp order

� Guardian extension

� -W flag added

$ ls -Wguardian [/G[/volume[/subvol[/filename]]]] ..

� Displays name and file code

� testobj 100

� testc 101

Page 36: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 36

Online Documentation

� man command displays online reference material

� $ man <command>

� spacebar next screen

� f next screen

� b previous screen

� <enter> next line

� <n>f forward n lines

� <n>b back n lines

� h display help

� q terminate

Page 37: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 37

Displaying the Contents of a Disk File

� cat command displays all the contents:

� $ cat /users/terry/testfile

� more command displays a page at a time:

� $ more /users/terry/testfile

� spacebar next screen

� f next screen

� b previous screen

� <enter> next line

� <n>f forward n lines

� <n>b back n lines

� h display help

� q terminate

� head command displays the first -n lines

� n defaults to 10

� tail command displays the last -n lines

� n defaults to 10

Page 38: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 38

Copy File Command - cp

� $ cp -options source destination

� Source and destination can be file or directory

� Destination file deleted without warning (except in /G/)

� Guardian option

� -Wclobber allows target Guardian file to be overwritten

� Guardian characteristics

� File attributes not preserved

� Guardian EDIT file copied into OSS disk file as unstructured

� OSS disk file copied to Guardian file as unstructured, code 180

� Guardian special case

� Copy Guardian file to Guardian file (similar to FUP DUP)

� File attributes preserved

� Depth of Guardian directory

� Limits recursive copies

Page 39: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 39

Renaming Files

� mv command changes the name of a file or directory:$ mv old-name new-name

� Can rename to a new directory:$ mv existing-file new-directory

� Absolute and relative pathnames are allowed

Page 40: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 40

Creating a Directory

� Create using absolute or relative pathname:$ mkdir /usr/tandem/webserver/testapp

$ mkdir stu99/newtest

� Note: The examples assume that higher level directories already exist.

� Uses default permissions

� Allowed on /G$ mkdir /G/volume/subvol

� Creates empty directory in OSS only

Page 41: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 41

Deleting Directories and Files

� rmdir command deletes directories

� Directories must be empty

� rm command deletes files

� -i flag means prompt for approval

� -r flag means delete subdirectories and files also

� Use with -i for safety

� $ rm -r -i stu99/newtest

� Allows deletion from /G

Page 42: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 42

file Command

� Displays file type

� Works on OSS and Guardian files

� File types determined include:

� Text files

� Files with “magic” values

� cpio or tar format files

� Object files

� Directory files

� FIFO files

� Special character files

� Needs vt100+ emulation

Page 43: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 43

File and Directory Security Overview

� Permissions are given to three user types:

� User (owner)

� Group

� Others

� Three access modes: Read, Write, Execute (rwx)

� Default security for new files and directories set by umask

� Permissions changed by chmod

� Ownership changed by chown command (super user only)

� Network (/E/<node>) access requires remote passwords

Page 44: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 44

400

200

100

40

20

10

4

2

1

User Group Others

r w x r w x r w x

Permissions Mask

• System default permissions are in code and are non-alterable• Set with umask command to specify what is subtracted from system default, thereby resulting in permission settings for new files/directories

• May be used in chmod command to alter permissions on existing files and directories

Page 45: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 45

Setting Default Security

� umask sets default permissions for new files or directories

� Does not change security for existing files or directories

� System default permissions are:

Owner Group Other

� Directory file: rwx rwx rwx (octal 777)

� Disk file: rw- rw- rw- (octal 666)

� umask in user’s profile overrides the umask in /etc/profile

� umask for user session overrides all default permissions

� Parameter value is subtracted from system default

� umask 066 — deny read and write permissions for group and others

� umask with no parameter displays current setting

Page 46: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 46

Changing Permissions

� chmod changes permissions on existing files/directories

� “Victor ugo” method:� u for owner, g for group, o for others, a for all users

� + adds permission

� - removes permission

� = sets all permissions

$ chmod u+x <file> add executable for user (owner)

$ chmod o-w <file> remove write for others

$ chmod a=rw <file> for all users allow read and write only

� Octal method:� set permissions with octal mask value:

$ chmod 744 <file> read, write, executable for owner; read only for group and others

� Allowed by file owner and super user only

� Not allowed on /G and /E

Page 47: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 47

Changing Ownership

� chown changes the owner of an existing file or directory

� Permitted only by the super IDsz

� Not even owner can alter ownership

� chown <new-owner> <file>

$ chown stu02 myfile

� chgrp changes the group of an existing file or directory

� Permitted by:

� user (owner) if member of new group

� super ID

� Group name can be:

� administrative group (0-255), with all names in uppercase

� filesharing group (256 - 65535), with case-sensitive names

� chgrp <new-group> <file>$ chgrp OSSGD myfile

$ chgrp Test myfile

Page 48: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 48

lp file1

lpstat

Spooling Operations

Page 49: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 49

lp Command

� Uses Guardian spooler to print files from OSS environment

� Consults /$HOME/printcap file or /etc/printcap file

� Aliases map to Guardian spooler locations

� hp4 $S.#LASER1

� lineprint $S.#LP

� User’s own printcap destinations take precedence

� The user’s default is the first entry in the user’s printcap file

� lp command writes file to destination:

� Use one of the following methods to indicate destination:

� -d flag

� export LPDEST or PRINTER environment variables

$ export LPDEST=hp4

$ lp -d hp4 myfile

$ ls | lp

$ cat myfile | lp

Page 50: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 50

Controlling the Spooler

� lpstat command displays status information

� Same information as PERUSE

� cancel command deletes a job$ cancel 123

Page 51: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 51

Processes

� TACL STATUS command shows Guardian and OSS processes

� ps command normally shows OSS processes only

� $ ps — Shows user’s processes

� $ ps –f — Gives more detail

� $ ps –e — Shows all OSS processes

� $ ps –l — Long listing

� These examples produce displays in “Guardian” format:

� $ ps -W all — Shows OSS and Guardian processes

� $ ps -W cpu=n — Shows all processes in a specified processor

� $ ps -W all,guser=<grp.user> — Shows all processes for a specified user

Page 52: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 52

The run Command

� Runs OSS processes with NonStop Kernel-specific attributes

� Command syntax:$ run [options] program [arguments]

� Examples:$ run -cpu=3 -gpri=50 -name=/G/myls ls -al

$ run -debug -inspect=on /test/proga

� Options include:

� -defmode=on|off

� -jobid=nnn

� -lib=/G/vol/subvol/libname

� -mem=mmm

� -term=/G/termname

Page 53: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 53

The kill Command

� Sends a signal to one or more running processes

� Examples:

� Terminate OSS process(es)

$ kill -s Kill <process-id> . . .

� Terminate all your background OSS process(es)

$ kill 0

� Terminate Guardian process

$ kill -s guardian /G/SVR1

$ kill -s GUARDIAN /G/5,48

� Obtain a listing of possible signals

$ kill -l

� Signal names are not case sensitive

Page 54: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

OSS File Editing

Module 4

Page 55: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 55

Editing Source Files

� EDIT files — Type 101, exist only in Guardian name space

� ASCII text files — Type 180, exist in OSS and Guardian name spaces

� Guardian programs can access only Guardian files —EDIT/TEDIT editors see only EDIT files

� OSS programs can access OSS and Guardian files — vi and ed editors see only ASCII text files

Page 56: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 56

Moving Files Between OSS and Guardian Environments

� Copying an EDIT file to an OSS file$ cp /G/data/reports/jan94 /home/stu01/report

� Reading a Guardian file into the ed buffer$ edr /G/data/reports/jan94

� Converting an OSS file to an EDIT file (two steps)

1. In the OSS environment:

$ cp /home/stu01/report /G/data/reports/jan94

2. In the Guardian environment:

TACL> CTOEDIT JAN94,EDIT94

� Converting an EDIT file to an OSS file

� In the Guardian environment:

TACL> EDITTOC EDIT94,JAN94

Page 57: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 57

Editors Available on NonStop Systems

� Guardian environment (for files with file code 101)

� EDIT [vs]

� TEDIT

� OSS environment (for text files)

� vi

� ed (unsupported utility)

Page 58: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 58

Three vi Modes

vi CommandMode

Input Mode

Last Line Mode

:

Return

ESC

Insert, Append,

Replace, Change

Page 59: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 59

Common vi Editor Commands (1 of 3)

� Starting vi$ vi <myfile>

� Cursor positioning

� h — Same as left arrow key

� l — Same as right arrow key

� j — Same as down arrow key

� k — Same as up arrow key

� Saving and exiting

� ZZ — Save changes and exit

� :w — Save changes, without exiting

� :q! — Exit without saving

� :wq — Same as ZZ

Page 60: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 60

Common vi Editor Commands (2 of 3)

� Insertion mode

� i — Begin insertion mode, in front of cursor

� a — Append after current position

� esc — Stop insertion or append mode

� Deletion

� dd — Deletes current line

� x — Deletes current character

� <n>dd — Deletes <n> lines starting from current

� dw — Deletes word

� Undo command (on line 25)

� :u — Undo most recent change

� :U — Undo all changes to current line

Page 61: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 61

Common vi Editor Commands (3 of 3)

� Pattern matching

� /<string> — Search for <string>, forwards

� ?<string> — Search for <string>, backwards

� ? — Find next occurrence

� String replacement

� :m,ns/<old-stg>/<new-stg>/[g] — Replace first occurrences of <old-stg> with <new-stg> from line numbers m to n (tagging “g” at end means global replacement)

� Miscellaneous

� :j — Join current line with the next

� :nJ — Join n lines

� i+Enter — Break line at current cursor position

Page 62: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 62

vi Terminal Settings

� The following must be specified:

� $ export TERM=vt100

� OV32 must be set to vt320, vt220, or vt100 for session emulation type.

Page 63: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 63

vi Session Options

� Set by the command::set <option>

� Common options are:

� errorbells — Specifies that when an error is made, a bell sounds. This is the default.

� ignorecase — Specifies that when searches are performed, the case of characters should be ignored. The default is noignorecase.

� number — Specifies that line numbers are to be displayed at the left margin. The default is nonumber.

� showmatch — Specifies that when you type a matching parenthesis or brace, the cursor moves to the matching character and returns. The default is noshowmatch.

� tabstop — Specifies the amount of space between tab stops. The default setting is eight spaces.

� View settings: :set all

Page 64: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 64

OSS Manuals

•Open System Services Installation Guide

•Open System Services Library Calls Reference Manual

•Open System Services Management and Operations Guide

•Open System Services Porting Guide

•Open System Services Programmer’s Guide

•Open System Services Shell and Utilities Reference Manual

•Open System Services System Calls Reference Manual

•Open System Services User’s Guide

http://docs.hp.com/

Page 65: Introduction to OSSwhp-hou4.cold.extweb.hp.com/pub/nonstop/ccc/jan2110.pdf · ©2002 hp (524907-001) 2 What Is OSS? NonStop Kernel Open System Services API, command interpreter, and

© 2002 hp (524907-001) 65