11
Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

Embed Size (px)

Citation preview

Page 1: Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

Significance of Scripting Languagesfor Operating System Administration

Vladimir MateljanŽeljka Požgaj

Krunoslav Peter

INFuture2007

Page 2: Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

Introduction

analysis of scripting programming languages

why they are significant for operating system (OS) administration, especially for automating administration tasks

Page 3: Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

OS Administration

GUI Tool –pointing and clicking

Command Line –writing and executing commands

Page 4: Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

Automation of OS Administration

sequences of OS’s shell commands – simple programming solutions – scripts

scripting languages (SLs) can be used for development of program solutions used in the automation of OS administration with a minimum code usage

Page 5: Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

Scripting Programming Languages

interpreted programming languages building applications from reusable

components rapid application development building minimalist but functional program

solutions examples:

bash – shell SL awk – a pattern scanning and text processing

language

Page 6: Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

The Shell Language - bash

simple and expressive syntax: command:

command [switch] [argument] statement:

command [; command] piping (sending data from one to another command):

command [| command] redirection (sending data to file):

command [> file] script:

statement[statement]

Page 7: Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

The Pattern Scanning and Text Processing Language - awk

the syntax for invoking awk: specifying a script on the command line:

awk ‘script’ file [file] invoking awk with a script file:

awk -f script file [file]

the structure of the awk script:pattern { procedure }pattern { procedure }...

example – counting rows in text file :$ awk '{ i++ } END { print i }' file.txt

Page 8: Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

Statement, Alias, and Script statement:$ ls | grep txt | wc -l

alias:$ alias lsx='ls | wc -l'

script:#!/bin/bashecho __Text Docs__ > doc.txtls | grep doc >> doc.txt

Page 9: Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

Pragmatics of SL

simple and expressive syntaxsingle data type – stringpowerful operations – piping and

redirectionexample – stoping process that has string

“sleep” in name:$ ps | awk '$4 ~ /sleep/ { cmd = "kill -9 " $1;

print | cmd }'

Page 10: Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

Significance of SLs for OS Administration

scripts – tools for automating common administration tasks

additional benefits: documenting steps of administration tasks history (execution log)

Page 11: Significance of Scripting Languages for Operating System Administration Vladimir Mateljan Željka Požgaj Krunoslav Peter INFuture2007

Conclusion

SLs are appropriate for rapid development of program solutions used in the automation of OS administration with a minimum code usage

integration of reusable components from the framework that includes OS's shell commands