System Administration HW3 Shell Script changlp Computer Center, - - PowerPoint PPT Presentation

system administration hw3 shell script
SMART_READER_LITE
LIVE PREVIEW

System Administration HW3 Shell Script changlp Computer Center, - - PowerPoint PPT Presentation

System Administration HW3 Shell Script changlp Computer Center, CS, NCTU Requirements User socket statistic (20%) Use one-line command to show per-user socket statistic ZFS snapshot management script (20%) Script for ZFS snapshot


slide-1
SLIDE 1

System Administration HW3 Shell Script

changlp

slide-2
SLIDE 2

Computer Center, CS, NCTU

2

Requirements

 User socket statistic (20%)

  • Use one-line command to show per-user socket statistic

 ZFS snapshot management script (20%)

  • Script for ZFS snapshot management/rolling

 RSS feed reader (60%)

  • A simple RSS feed reader using cdialog(1)
slide-3
SLIDE 3

Computer Center, CS, NCTU

3

User Socket Statistic – Requirements (1/2)

 Use one-line command to show user socket statistic

  • $ sockstat

 The output should be sorted by socket count in descending

  • rder

 Socket count threshold

  • Use environment variable „THRESHOLD‟
  • Treat as 0 if „THRESHOLD‟ is not set

 Output format

  • User: count ( processes… )
slide-4
SLIDE 4

Computer Center, CS, NCTU

4

User Socket Statistic – Requirements (2/2)

 Only pipes (cmd | cmd) and backquotes (`cmd`) are allowed  No temporary files and variables (e.g. environment vars except THRESHOLD)  No “&&” “||” “>” “>>” “<“

slide-5
SLIDE 5

Computer Center, CS, NCTU

5

User Socket Statistic - Example

slide-6
SLIDE 6

Computer Center, CS, NCTU

6

ZFS Snapshot Management Script – Requirements (1/2)

 Write a script to do ZFS snapshot and snapshot rolling

  • cron(8)

 Syntax

  • zfsSnap.sh -f <fs> -n <name> <-c <count> | -d>
  • -f
  • Target ZFS dataset
  • -n
  • Name of ZFS snapshot
  • -c
  • Number of ZFS snapshot copy to preserve
  • -d
  • Delete snapshots in <fs> with <name>
  • Note that –c and –d are exclusive options
slide-7
SLIDE 7

Computer Center, CS, NCTU

7

ZFS Snapshot Management Script – Requirements (2/2)

 Logging with syslog

  • logger(1)
  • Please log PID, script name into local7.notice
  • Your script should output log when
  • Old snapshots rotated
  • New snapshots taken
  • Snapshots deleted

Oct 27 15:32:08 Archon zfsSnap[2699]: Old snapshot: zTmp@test.2 rotated Oct 27 15:32:10 Archon zfsSnap[2709]: New snapshot: zTmp@test.0 Oct 27 15:32:13 Archon zfsSnap[2727]: Deleted snapshots: zTmp@test.*

slide-8
SLIDE 8

Computer Center, CS, NCTU

8

ZFS Snapshot Management Script - Example

 Create snapshot (-c count)  Delete snapshot (-d)

slide-9
SLIDE 9

Computer Center, CS, NCTU

9

RSS Feed Reader – Requirements (1/2)

 Write a simple RSS reader with GUI

  • devel/cdialog

 Support the following functions

  • Read (15%)
  • Read subscribed feed
  • Add (15%)
  • Add new subscription
  • Delete (15%)
  • Delete existing subscription
  • Update (15%)
  • Update subscription

 Please store all files into ./feed/

slide-10
SLIDE 10

Computer Center, CS, NCTU

10

RSS Feed Reader – Requirements (2/2)

slide-11
SLIDE 11

Computer Center, CS, NCTU

11

RSS Feed Reader – Read

slide-12
SLIDE 12

Computer Center, CS, NCTU

12

RSS Feed Reader – Add

Use site title as default feed name

slide-13
SLIDE 13

Computer Center, CS, NCTU

13

RSS Feed Reader – Delete

You must remove related files / directories

slide-14
SLIDE 14

Computer Center, CS, NCTU

14

RSS Feed Reader – Update

slide-15
SLIDE 15

Computer Center, CS, NCTU

15

RSS Feed Reader – RSS Parser

 For simplicity, TA would provide a simple RSS parser

  • https://raw.github.com/iamben/fetchFeeds/master/fetchFeeds.py
  • https://github.com/iamben/fetchFeeds
  • README

 Write your own one

  • textproc/hs-feed
  • textproc/p5-XML-FeedPP
  • textproc/pear-XML_Feed_Parser
  • textproc/py-feedparser
  • textproc/ruby-rss
slide-16
SLIDE 16

Computer Center, CS, NCTU

16

Hand-in

 Due

  • 2011/11/15 18:30

 Demo & How

  • TBA
slide-17
SLIDE 17

Computer Center, CS, NCTU

17

Help

 IRC channel #nctuNASA on freenode  Newsgroup cs.course.sysadmin  BBS bs2.to board CS-SysAdmin  Email ta@nasa.cs.nctu.edu.tw  Goto CSCC to ask professional 3F!