Upload
jagadish-paul
View
226
Download
0
Embed Size (px)
Citation preview
8/12/2019 Introduction to OSS
1/65
Introduction to OSS
Module 1
8/12/2019 Introduction to OSS
2/65
2002 hp (524907-001) 2
What Is OSS?
NonStop Kernel Open System Services
API, command interpreter, and utilities
HP NonStop system implementation of POSIX openstandards
Familiar interface and capabilities on top of NonStop systemfundamentals
8/12/2019 Introduction to OSS
3/65
2002 hp (524907-001) 3
Characteristics of Open Systems
Compatibility Applications running on the system will beable to run on future versions of the system.
Portability Applications running on the operating system
on a given hardware platform will run on any vendorssystem that utilizes that same operating system.
Scalability Applications written for the system will run onthe full range of computer architectures and sizes.
Interoperability Applications running on the system willbe able to communicate with any other system using thesame networking protocols.
8/12/2019 Introduction to OSS
4/65
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
8/12/2019 Introduction to OSS
5/65
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
8/12/2019 Introduction to OSS
6/65
2002 hp (524907-001) 6
Commandsand Utilities
(POSIX)
Base Profile
C (ISO and Common Usage)
Internationalized SystemCalls and Libraries
(POSIX)
OperatingSystem andLanguages
ADAPascalFORTRANCOBOL
X/OPEN XPG4
8/12/2019 Introduction to OSS
7/65
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
8/12/2019 Introduction to OSS
8/65
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
...
8/12/2019 Introduction to OSS
9/65
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 ...
8/12/2019 Introduction to OSS
10/65
2002 hp (524907-001) 10
Guardian Environment
Database Management
Systems Management
SNA,X25,TCP/IP
Pathway
Database ManagementSystems Management
DCE/TCP/IPTUXEDO
Guardian Services
Guardian UtilitiesGuardian APIs
OSS UtilitiesOSS APIs
Application
Open System Svcs
OSS Environment
NonStop Kernel
NonStop Kernel Environments
8/12/2019 Introduction to OSS
11/65
2002 hp (524907-001) 11
NonStop Kernel
Guardian API
250+ Functions
POSIX.1/XPG4 API
250+ Functions150+ C Functions
POSIX.2/XPG4 Toolsand Utilities
Guardian Services
Tools and Utilities
TACL
Open System Services
Processes
File systemI/OPipes/FIFOsSignals
l18N (L10N)
OSS Product Features
8/12/2019 Introduction to OSS
12/65
2002 hp (524907-001) 12
3
1
Guardian API OSS API
GuardianProcess
OSSProcess
GuardianObjects
4
OSSObjects
2
Interoperability with Guardian Environment
1. Access to Guardianservices from OSSprocesses
2. Access to OSS services
from Guardian processes3. Accessing Guardian files
4. Accessing OSS files andobjects
8/12/2019 Introduction to OSS
13/65
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
8/12/2019 Introduction to OSS
14/65
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
8/12/2019 Introduction to OSS
15/65
OSS File System Basics
Module 2
8/12/2019 Introduction to OSS
16/65
2002 hp (524907-001) 16
Getting In and Out
Logged in directly
With TELNET
Available Services:
OSS TACL EXITEnter Choice> oss
login:
Initiated from TACL with OSH1> osh
8/12/2019 Introduction to OSS
17/65
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
8/12/2019 Introduction to OSS
18/65
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
8/12/2019 Introduction to OSS
19/65
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
8/12/2019 Introduction to OSS
20/65
8/12/2019 Introduction to OSS
21/65
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 beginwith a slash (/)
File name Guardian file name File descriptor (fd)
Guardian file number (fnum)
File system
8/12/2019 Introduction to OSS
22/65
2002 hp (524907-001) 22
OSS Pathname
Made up of one or more component directory namesseparated 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 (.)
8/12/2019 Introduction to OSS
23/65
2002 hp (524907-001) 23
OSS Pathname to Guardian Files (1 of 2)
/G directory for local files
Disk: /G/[/[/filename]]
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/
Same character removal and length restrictions as for disk files
$ZVPT is accessed as /G/ZVPT
8/12/2019 Introduction to OSS
24/65
2002 hp (524907-001) 24
OSS Pathname for Guardian Files (2 of 2)
/E directory for remote systems
Remote passwords needed
/E/
has no leading \
/E//G
Examples:
\REMOTE.$DATA.MYSUB.AFILE is accessed as
/E/REMOTE/G/DATA/MYSUB/AFILE
8/12/2019 Introduction to OSS
25/65
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
8/12/2019 Introduction to OSS
26/65
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)
8/12/2019 Introduction to OSS
27/65
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
8/12/2019 Introduction to OSS
28/65
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
8/12/2019 Introduction to OSS
29/65
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
/
8/12/2019 Introduction to OSS
30/65
2002 hp (524907-001) 30
file and tty Commands
The file command displays the file type of OSS and Guardianfiles
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
8/12/2019 Introduction to OSS
31/65
Basic Commands and Utilities
Module 3
F nctionall Eq i alent OSS Commands for
8/12/2019 Introduction to OSS
32/65
2002 hp (524907-001) 32
Functionally Equivalent OSS Commands forGuardian 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
8/12/2019 Introduction to OSS
33/65
2002 hp (524907-001) 33
alias cpio fold lp ps trar csplit gencat lpstat pwd trueawk cut genxlt ls read tty
basename date getconf make rm type
bc dc getopts man rmdir umaskbg diff grep mkcatdefs sed unaliasc89 dirname head mkdir sh unamecancel echo iconv mkfifo sleep uncompresscat ed id more sort unexpand
cd egrep ipcrm mv split uniq chgrp env ipcs nm strings uudecodechmod expand jobs nohup strip uuencodechown expr join od stty vicksum false kill passwd tail wait
cmp 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
8/12/2019 Introduction to OSS
34/65
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
8/12/2019 Introduction to OSS
35/65
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
8/12/2019 Introduction to OSS
36/65
8/12/2019 Introduction to OSS
37/65
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
next line f forward n lines
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
8/12/2019 Introduction to OSS
38/65
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
8/12/2019 Introduction to OSS
39/65
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
8/12/2019 Introduction to OSS
40/65
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
8/12/2019 Introduction to OSS
41/65
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
8/12/2019 Introduction to OSS
42/65
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
8/12/2019 Introduction to OSS
43/65
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/) access requires remote passwords
8/12/2019 Introduction to OSS
44/65
2002 hp (524907-001) 44
400
200100
40
20
104
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 existingfiles and directories
8/12/2019 Introduction to OSS
45/65
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 users 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
8/12/2019 Introduction to OSS
46/65
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 add executable for user (owner)
$ chmod o-w remove write for others
$ chmod a=rw for all users allow read and write only
Octal method: set permissions with octal mask value:
$ chmod 744 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
8/12/2019 Introduction to OSS
47/65
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
$ 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 $ chgrp OSSGD myfile
$ chgrp Test myfile
S O
8/12/2019 Introduction to OSS
48/65
2002 hp (524907-001) 48
lp file1
lpstat
Spooling Operations
l C d
8/12/2019 Introduction to OSS
49/65
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
Users own printcap destinations take precedence
The users default is the first entry in the users 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
C t lli th S l
8/12/2019 Introduction to OSS
50/65
2002 hp (524907-001) 50
Controlling the Spooler
lpstat command displays status information
Same information as PERUSE
cancel command deletes a job
$ cancel 123
P
8/12/2019 Introduction to OSS
51/65
2002 hp (524907-001) 51
Processes
TACL STATUS command shows Guardian and OSSprocesses
ps command normally shows OSS processes only
$ ps Shows users 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= Shows all processes for a specifieduser
The run Command
8/12/2019 Introduction to OSS
52/65
2002 hp (524907-001) 52
The run Command
Runs OSS processes with NonStop Kernel-specificattributes
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
The kill Command
8/12/2019 Introduction to OSS
53/65
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 . . . 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
OSS File Editing
8/12/2019 Introduction to OSS
54/65
OSS File Editing
Module 4
Editing Source Files
8/12/2019 Introduction to OSS
55/65
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 namespaces
Guardian programs can access only Guardian files EDIT/TEDIT editors see only EDIT files
OSS programs can access OSS and Guardian files vi anded editors see only ASCII text files
Moving Files Between OSS and GuardianEnvironments
8/12/2019 Introduction to OSS
56/65
2002 hp (524907-001) 56
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/jan942. In the Guardian environment:
TACL> CTOEDIT JAN94,EDIT94
Converting an EDIT file to an OSS file
In the Guardian environment:
TACL> EDITTOC EDIT94,JAN94
Editors Available on NonStop Systems
8/12/2019 Introduction to OSS
57/65
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)
Three vi Modes
8/12/2019 Introduction to OSS
58/65
2002 hp (524907-001) 58
Three vi Modes
vi CommandMode
Input Mode
Last LineMode
:
Return
ESC
Insert, Append,
Replace, Change
Common vi Editor Commands (1 of 3)
8/12/2019 Introduction to OSS
59/65
2002 hp (524907-001) 59
Common vi Editor Commands (1 of 3)
Starting vi$ vi
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
Common vi Editor Commands (2 of 3)
8/12/2019 Introduction to OSS
60/65
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
dd Deletes lines starting from current
dw Deletes word
Undo command (on line 25)
:u Undo most recent change :U Undo all changes to current line
Common vi Editor Commands (3 of 3)
8/12/2019 Introduction to OSS
61/65
2002 hp (524907-001) 61
Common vi Editor Commands (3 of 3)
Pattern matching
/ Search for , forwards
? Search for , backwards
? Find next occurrence String replacement
:m,ns///[g] Replace first occurrences of with 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
vi Terminal Settings
8/12/2019 Introduction to OSS
62/65
2002 hp (524907-001) 62
e a Sett gs
The following must be specified:
$ export TERM=vt100
OV32 must be set to vt320, vt220, or vt100 for session
emulation type.
vi Session Options
8/12/2019 Introduction to OSS
63/65
2002 hp (524907-001) 63
p
Set by the command::set
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 caseof characters should be ignored. The default is noignorecase.
number Specifies that line numbers are to be displayed at the leftmargin. The default is nonumber.
showmatch Specifies that when you type a matching parenthesisor brace, the cursor moves to the matching character and returns.The default is noshowmatch.
tabstop Specifies the amount of space between tab stops. Thedefault setting is eight spaces.
View settings:
:set all
OSS Manuals
8/12/2019 Introduction to OSS
64/65
2002 hp (524907-001) 64
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 Programmers Guide
Open System Services Shell and Utilities Reference Manual
Open System Services System Calls Reference Manual
Open System Services Users Guide
http://docs.hp.com/
8/12/2019 Introduction to OSS
65/65
2002 hp (524907-001) 65