An Application Programmer’s Guide to UNIX at the University of Manitoba by Gary F. Alderson Manager, Application Technologies Administrative Systems Version: 1.8 2002-03-03 Table of Contents Table of Contents ............................................................................................................................2 Introduction.....................................................................................................................................4 The Shells........................................................................................................................................4 Interactive use of the Shell .............................................................................................................5 Command Aliases........................................................................................................................................6 Command History.......................................................................................................................................6 Command Line Editing ..............................................................................................................................7 Security and Permissions................................................................................................................9 The Basics ....................................................................................................................................................9 Setting File Creation Defaults....................................................................................................................9 Setting Permissions after Creation..........................................................................................................10 Security Groups.........................................................................................................................................10 Set Group-ID Permission .........................................................................................................................11 Set Userid Permission ...............................................................................................................................11 Save Text Image after Execution.............................................................................................................11 Directory Structure Set-up for Production Batch Applications..................................................12 Directory Structures for Development and Production WEB Servers........................................13 Why do we have multiple Web servers?.................................................................................................13 The Common Administrative Systems Web Server Directory Structure ...........................................14 Best Practices.............................................................................................................................................15 Writing Shell Scripts.....................................................................................................................16 Example 1 - A basic shell script. ..............................................................................................................16 Example 2 - A sample database load.......................................................................................................17 Example 3 - A script called by other scripts...........................................................................................19 Best Practices.............................................................................................................................................22 CronTab - Production Job Scheduling ........................................................................................23 Pipes, Redirection, Filters and Other Plumbing Fixtures ..........................................................25 Dataflow through Commands..................................................................................................................25 Redirecting Input and Output .................................................................................................................25 Filters..........................................................................................................................................................26 cat ................................................................................................................................................................................26 sort...............................................................................................................................................................................26 head..............................................................................................................................................................................26 tail................................................................................................................................................................................26 more or less..................................................................................................................................................................27 grep..............................................................................................................................................................................27 cut ................................................................................................................................................................................27 sed and awk..................................................................................................................................................................28 Page 2 tar.................................................................................................................................................................................28 gzip ..............................................................................................................................................................................28 find...............................................................................................................................................................................29 find /priv/adminsys/wwwprod –name \*.pl -print ........................................................................................................29 PERL - Practical Extraction and Reporting Language ..............................................................30 Perl Style Guide.........................................................................................................................................30 Example 1 - Using PERL to Substitute Text ..........................................................................................30 Example 2 - Preparing a file for a Sybase BCP Load............................................................................31 Example 3 - A Simple Report using Sybperl ..........................................................................................32 Example 4 - Updating a Sybase Table using Sybperl ............................................................................34 Source Code Management using CVS.........................................................................................38 Setting Up a CVS Repository...................................................................................................................38 Deciding on Project Granularity .............................................................................................................38 Automatic Documentation .......................................................................................................................38 Importing New Projects ...........................................................................................................................39 Checking Out Projects..............................................................................................................................39 Updating Projects......................................................................................................................................39 Watching Projects for Changes ...............................................................................................................39 Who is Watching You ?............................................................................................................................40 Adding Files to the Project.......................................................................................................................40 Removing Files from the Project.............................................................................................................40 Committing Project Releases...................................................................................................................40 Releasing Your Project Sandbox.............................................................................................................40 More Information is Available at ... ........................................................................................................41 Suggestions and Ideas for Improvement......................................................................................42 Page 3 Introduction In the world of Client/Server
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages42 Page
-
File Size-