BC-isit442 Class Overview And Structure
Version 0.1
January 05, 2016
http://mohsen.banan.1.byname.net/PLPC/120048
Contents
- Part I Basics Of Bash Scripting
- Part II Init System Of Our Unix Universe
- Part III Uses Of Accounts In Our Unix Universe
- Part IV Class Activities
- Part V Assignments
Part I |
<presentation>
[plain] Part 1: Basics Of Bash Scripting
Contents
- Part I Basics Of Bash Scripting
- Part II Init System Of Our Unix Universe
- Part III Uses Of Accounts In Our Unix Universe
- Part IV Class Activities
- Part V Assignments
[part=1]
1 History Of sh, ksh and bash
History Of sh, ksh and bash
- Bourn Shell
- Korn Shell 88, Korn Shell 93
- The IEEE 1003.2 POSIX Shell Standard
- Bash 4
- Dash
2 Can Bash Be Considered A Complete Programming Language?
Can Bash Be Considered A Complete Programming Language?
- Scoping is almost all there
- Integer Arithmetic Is Now Native
- Associative Arrays Are In Place
Library Support/Richness?
From a certain perspective all of unix commands can be considered Bash’s library, but that is different from language libraries
There is a lot that can be done in Bash. Beyond that switch to Python.
3 Consider Getopt
Consider Getopt
- What is getopt?
- Examples of hiding getopt in bash libraries
4 Bash’s Minimalist Approach Vs The Framework Oriented Approach
Bash’s Minimalist Approach Vs The Framework Oriented Approach
- Sometimes self-contained scripting is the right approach
- Sometimes you need a framework to build on
We will be experimenting with both approaches.
5 Bash Based ByStar Interactively Invokable Modules (Bash IIMs)
Bash Based ByStar Interactively Invokable Modules (Bash IIMs)
ByStar IIMs are scripts that consistently:
- Meant to also be invoked interactively.
- Encapsulate well defined functionality with in a single script (BinsPrep, Manage, DaemonAdmin)
- Actions are invoked with “-i”
- Parameters are communicated with “-p name=value”
- Universality of “-v” “-n showRun”
- All standard capabilities is hiden from individual modules
- Bash IIMs can then be augmented by IIM-Bash-Panels
Part II |
<presentation>
[plain] Part 2: Init System Of Our Unix Universe
Contents
- Part I Basics Of Bash Scripting
- Part II Init System Of Our Unix Universe
- Part III Uses Of Accounts In Our Unix Universe
- Part IV Class Activities
- Part V Assignments
[part=2]
6 System V Init System
System V Init System
- Run Levels
- /etc/init.d Directory
- A look at an example init.d script: start/stop/status
7 Daemontools
Daemontools
Benefits of Daemontools:
- SysV Init is primarily monolithic and convention oriented
- Daemontools is compositional
- daemontools is a collection of tools for managing UNIX services.
- Let’s Walk Through https://cr.yp.to/daemontools.html
8 File Variables As The Most Simple Control Method
File Variables As The Most Simple Control Method
Daemon Control Methods Considerations:
- Getopt
- Databases And Windows Style Registeries
- File Variables
- Environment Variables
Part III |
<presentation>
[plain] Part 3: Uses Of Accounts In Our Unix Universe
Contents
- Part I Basics Of Bash Scripting
- Part II Init System Of Our Unix Universe
- Part III Uses Of Accounts In Our Unix Universe
- Part IV Class Activities
- Part V Assignments
[part=3]
9 Abstractions Of Accounts In The Unix Model
Abstractions Of Accounts In The Unix Model
- Unix Accounts Are Reflected In /etc/passwd
- Each Account Has a UserId
- Each UserId Can Be Associated With Multiple Groups
- Each Account May Have A Shell – or No Shell
- Each Account May Have A Home Directory – Or No Home Directory
- Each Account May Have A Password Or No Password
10 Uses Of Unix Accounts
Uses Of Unix Accounts
Unix Accounts Can Be Used For Many Purposes:
- Allow Users To Login (very traditional)
- Track, Monitor and Limit (Bound) Activities Of Programs (traditional)
- Be A Basis For Storing Information/Data (not very common)
- Be A Basis For Authentication and Access Control For Programs (traditional)
- Be A Basis For Compund Abstraction (for example instead of databases)
ByStar Messaging System Makes Very Heavy Use Of Unix Accounts.
Part IV |
<presentation>
[plain] Part 4: Class Activities
Contents
- Part I Basics Of Bash Scripting
- Part II Init System Of Our Unix Universe
- Part III Uses Of Accounts In Our Unix Universe
- Part IV Class Activities
- Part V Assignments
[part=4]
11 Emacs As A System Administration Tool
11.1 More On Major and Minor Modes
More On Major and Minor Modes
- Walk Through Of Major Modes Panel
- Walk Through Of Minor Modes Panel
- Walk Through Of Emacs Survival Guide
- Walk Through Of Emacs Reference Sheet
11.2 Org-Mode
Org-Mode
- Walk Through Of Org-Mode Reference Sheet
12 Bash Scripting – The Minimalist And The Framework Oriented Approach
12.1 Minimalist Bash Scripting
Minimalist Bash Scripts
- touch /isit442/lastName-minimal.sh
- A simple standalone script reads its first arg as a filename.
- Checks to see if file exists
- outputs accordingly
12.2 Framework Oriented Bash Scripting
Framework Oriented Bash Scripting
- cp /opt/public/osmt/bin/startIimGeneric.sh /isit442/lastName-iim.sh
- Add VisExample
- Add Describe
- Add Functionality
Part V |
<presentation>
[plain] Part 5: Assignments
Contents
- Part I Basics Of Bash Scripting
- Part II Init System Of Our Unix Universe
- Part III Uses Of Accounts In Our Unix Universe
- Part IV Class Activities
- Part V Assignments
[part=5]
13 Assignments
[plain]Assignments
- Read through “man getopt”
- Page through https://cr.yp.to/daemontools.html
- Page through Bash Scripting Reference Sheet (Cheat Sheet)
- Write a simple standalone bash script that reads one argument (path to a file) if the files exists, it prints to stdout a message and exits with exit code 0, if the file does not exist, it exists with exit code 1 and prints to both stdout and stderr a message that the file does not exist. Call the script lastName-fcheck.sh. Email it to me by next week (Jan 26).
- Play with and enhance the actionIims.sh that we build in class.
- Read throuhg http://www.by-star.net
- Only dig deeper into its references if you want to
- Focus on the following sections: 4.2.1 “The ByStar Ref Model”, 4.3 and all 5.