168-29: Swimming Through and Tapping out a CA-7 Mainframe

Total Page:16

File Type:pdf, Size:1020Kb

168-29: Swimming Through and Tapping out a CA-7 Mainframe SUGI 29 Posters Paper 168-29 Swimming through and tapping out a CA-7 Mainframe Scheduler on a Unix Server David Steves and Denise Figliozzi SunTrust Bank, Atlanta, Georgia Abstract In a large organization, security concerns often preclude CA7 mainframe scheduler tools from being available to SAS developers. New and inventive ways must be discovered to submit mainframe (MVS) jobs on a reliable basis. One method involves the invocation of a UNIX Cron Job and SAS Connect logic. The combination of using the CRON feature on the UNIX server with the many SAS features has made this a very reliable and successful scheduling technique. This paper will review how to create a CRON job and configure a mainframe job with JCL to enable the program to emulate a CA7 scheduler. To illustrate how mainframe jobs are submitted concurrently, (or independently contingent on file availability on the mainframe), we will look at SAS production code. Introduction In a financial company, we are sometimes forced to invent processes that help us circumvent misguided company policies. Sometimes during financial reporting periods programmers are not able to schedule jobs in production through CA7. If a programmer wants to submit a SAS job at 3:00 a.m., he would have to physically logon to the mainframe and manually submit the program. The process below will illustrate an easy alternative for scheduling. This process will only work if the userid has RACF access to mainframe files. We will illustrate some easy concepts in the UNIX environment that, in combination with other SAS Connect logic, allow us to submit programs. What is CRON? In the UNIX world, CRON is a tried and true scheduler for running UNIX scripts. This crontab file represents the time (of day) a job will execute. The crontab file will always be located on the root drive. To utilize the CRON feature, we must add/edit entries into a crontab. SUGI 29 Posters Paper 168-29 CRON job set up in UNIX Step 1: UNIX Command: cd /var/spool/cron/crontabs Step 2: Edit root file (crontabs) The structure of the file will be in 6 parts: Column 1: minute Column 2: hour Column 3: day of month Column 4: month of year Column 5: day of week Column 6: command • All columns must be populated with an asterisk (*) if null • Military time is used • Day of the week translates to: Sunday=0 through Saturday=6 • User may need administrator privileges to edit this file . Step 3: Start and restart the CRON for the new settings to be captured. To stop CRON: Ps-ef |grep cron (will show you the process id for root file) Kill- 9 process id (kills the process id for root file) Rm /etc/cron.d/FIFO (this will erase the lock file) To start CRON: Nohup /usr/sbin/cron & (restarts the CRON with new settings) Example of crontab # 0 4 * * 1,2,3,4,5 /gs/dailyagent.run 30 4 * * 1,2,3,4,5 /gs/dailyagent.run 0 5 * * 1,2,3,4,5 /gs/dailyagent.run 30 5 * * 1,2,3,4,5 /gs/dailyagent.run 00 6 * * 1,2,3,4,5 /gs/dailyagent.run 30 6 * * 1,2,3,4,5 /gs/dailyagent.run 00 7 * * 1,2,3,4,5 /gs/dailyagent.run SUGI 29 Posters Paper 168-29 15 7 * * 1,2,3,4,5 /gs/dailyagent.run 30 7 * * 1,2,3,4,5 /gs/dailyagent.run 45 7 * * 1,2,3,4,5 /gs/dailyagent.run 00 8 * * 1,2,3,4,5 /gs/dailyagent.run 15 8 * * 1,2,3,4,5 /gs/dailyagent.run 30 8 * * 1,2,3,4,5 /gs/dailyagent.run 45 8 * * 1,2,3,4,5 /gs/dailyagent.run 00 9 * * 1,2,3,4,5 /gs/dailyagent.run 15 9 * * 1,2,3,4,5 /gs/dailyagent.run 30 9 * * 1,2,3,4,5 /gs/dailyagent.run 45 9 * * 1,2,3,4,5 /gs/dailyagt3.run 00 11 * * 1,2,3,4,5 /gs/dailyagt4.run • Note that dailyagent.run commences every ½ hour from 4:00 a.m. until 7:00 a.m. After 7:00 a.m., dailyagent.run executes in 15 minute intervals and finishes at 9:30 a.m. Analyzing the dailyagent.run program Essentially, a UNIX shell script examines a flag file and if no flag file exists then the UNIX script submits a mainframe job through a SASTSO connect script. Once the mainframe job has completed, a flag file is FTP’d back to the UNIX box. As the CRON cycle continues, a job starts again in 30 minutes and spawns the necessary code to re-submit a particular mainframe job as needed. Sample Code of UNIX script: #! /bin/ksh # dailyagent.run # -------------------------------------------------------------; # Started 11/02/2001 by david steves ; # # Sas Portion: # ------------------------------------------------------------- cat > dailyagent.sas << EOT *********************************************************************** *** The next few lines validate the existence of a file *** ************************************************************* %let thefile4='/transfer/pingcomp.txt'; SUGI 29 Posters Paper 168-29 filename testit4 pipe "if [ ! -f &thefile4 ]; then echo 'no'; else echo 'yes'; fi"; data _null_; infile testit4 pad missover lrecl=3; input answer $3.; put answer=; call symput('exists',answer); run; *********************************************************************** *** If the file exists, then validate if the file contains data. *** *********************************************************************** %macro exist; %if &exists =yes %then %do; filename telldt4 '/transfer/pingcomp.txt'; data trndate4; infile telldt4 obs=1; input @1 result $1. @3 rundate mmddyy10.; run; data _null_; if 0 then set trndate4 nobs=nobs; put nobs=; call symput('numcnt',left(put(nobs,8.))); run; *********************************************************************** * Check and evaluate the data date. Create a flag that will indicate *** * whether or not to proceed with the mainframe submission . **** ************************************************************* %if &numcnt>0 %then %do; (will fall down this path if there is some sort of file) data trndate4; infile telldt4 obs=1; input @1 result $1. @3 rundate mmddyy10.; if result in ('Y') and rundate =today() then do; theresult = 2; put theresult =; call symput('results',left(put(theresult,8.))); end; else do; SUGI 29 Posters Paper 168-29 theresult = 1; put theresult =; call symput('results',left(put(theresult,8.))); end; run; %end; %else %do; (will fall down this path if file exists and the flag indicates that the file is not valid or null) data _null_; theresult3 = 1; put theresult3=; call symput('results',left(put(theresult3,8.))); run; %end; %end; %else %if &exists =no %then %do; (will fall down this path if no file exists) data _null_; theresult2 = 1; put tres2=; call symput('results',left(put(theresult2,8.))); run; %end; %mend exist; %exist; *********************************************************************** *If the flag file indicates that we need a different file, then we submit ** *** the mainframe code to get a new file. **** ************************************************************* %macro results4; %if &res4=2 %then %do; (will fall through this code if the file is useable) data skippy1; dt = ‘file already exists and is current'; run; %end; SUGI 29 Posters Paper 168-29 %else %do; (will fall through this code if the file is not valid ) ************************************************************************ **** This code uses a SAS script to log onto the mainframe system ******* filename netrc '/export/home/sugiuser/.netrc'; data testnet; infile netrc obs=1; input @38 t2 $8.; t3 = "'"||t2||"'"; call symput('pwd',t3); run; filename rlink '/gs/sastso2.scr'; %let mvsga=1x.x9.xxx.x2; options comamid=tcp; signon mvsga; ***** Please note this is a mainframe submission ********* rsubmit; tso submit ‘sugiuser.prod.sas(compass)'; endrsubmit; signoff mvsga; %end; %mend results4; %results4; EOT # ------------------------------------------------------------- # Run Jobs: # ------------------------------------------------------------- ************************************************************************ **** The following code creates a SAS log with different time/date **** *** stamps, that can later be used to decipher errors if there are any.** ************************************************************************ SUGI 29 Posters Paper 168-29 /opt/sas8/sas /gs/dailyagent.sas -log /gs/dailyagent$(date +"%y%m%d.%H%M%S").log - print /gs/dailyagent$(date +"%y%m%d.%H%M%S").lst -linesize 80 Mainframe JCL Code : *** submission of Mainframe Code ****** Mainframe JCL looks easy to create : ** note on Step030 condition code runs step only if return code < 4. //UGXX JOB (9999,9999),'D STEVES',MSGCLASS=A, // CLASS=E,NOTIFY=UGXX //* /*ROUTE XEQ PRODDB21 //STEP010 EXEC SAS //NEWFILE1 DD DSN=UGXX.TM.FTP.COMPASS,DISP=(NEW,CATLG,DELETE), // DCB=(RECFM=VB,LRECL=220) //NEWFILE2 DDDSN=UGXX.TM.FTP.PING.COMPASS,DISP=(NEW,CATLG,DELETE), // DCB=(RECFM=FB,LRECL=80) //SYSIN DD DSN=UGXX.PROD.SAS(COMPASSC),DISP=SHR //* //* This FTP’s the ping file to the UNIX box //STEP020 EXEC PGM=FTP,PARM='12.xx.xxx.22 (EXIT',REGION=4096K //STEPLIB DD DSN=SYS2.APF.CEE.SCEERUN,DISP=SHR //SYSFTPD DD DSN=SYSN.TCPIP.PROD.PARMS(FTPSDATA),DISP=SHR //INPUT DD DSN=UGXX.PROD.SAS(FTPCLS),DISP=SHR //OUTPUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSMDUMP DD SYSOUT=* //ABEND EXEC PGM=ABEND,COND=(0,EQ,STEP020) //* //STEP030 EXEC PGM=FTP,COND=(4,LT),PARM='12.XX.XXX.22 (EXIT', // REGION=4096K //STEPLIB DD DSN=SYS2.APF.CEE.SCEERUN,DISP=SHR //SYSFTPD DD DSN=SYSN.TCPIP.PROD.PARMS(FTPSDATA),DISP=SHR //INPUT DD DSN=UGXX.PROD.SAS(FTPCLS2),DISP=SHR //OUTPUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSMDUMP DD SYSOUT=* //* //STEP040 EXEC PGM=IEBGENER SUGI 29 Posters Paper 168-29 //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSN=UGXX.TM.FTP.COMPASS,DISP=SHR //SYSUT2 DD DSN=UGXX.TM.COMPASS.FTP(+1),DISP=(NEW,CATLG,KEEP) //SYSIN DD DUMMY /* //STEP050 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=A //SYSIN DD * DELETE UGXX.TM.FTP.COMPASS /* //STEP060 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=A //SYSIN DD * DELETE UGXX.TM.FTP.PING.COMPASS /* Conclusion We have armed you with the tools that you need to swim through and tap out a pseudo CA7 scheduler on your own. Understanding the flow process will hopefully make you aware of an old scheduling tool (CRON) that has many uses inside the UNIX environment.
Recommended publications
  • Administering Unidata on UNIX Platforms
    C:\Program Files\Adobe\FrameMaker8\UniData 7.2\7.2rebranded\ADMINUNIX\ADMINUNIXTITLE.fm March 5, 2010 1:34 pm Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta UniData Administering UniData on UNIX Platforms UDT-720-ADMU-1 C:\Program Files\Adobe\FrameMaker8\UniData 7.2\7.2rebranded\ADMINUNIX\ADMINUNIXTITLE.fm March 5, 2010 1:34 pm Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Notices Edition Publication date: July, 2008 Book number: UDT-720-ADMU-1 Product version: UniData 7.2 Copyright © Rocket Software, Inc. 1988-2010. All Rights Reserved. Trademarks The following trademarks appear in this publication: Trademark Trademark Owner Rocket Software™ Rocket Software, Inc. Dynamic Connect® Rocket Software, Inc. RedBack® Rocket Software, Inc. SystemBuilder™ Rocket Software, Inc. UniData® Rocket Software, Inc. UniVerse™ Rocket Software, Inc. U2™ Rocket Software, Inc. U2.NET™ Rocket Software, Inc. U2 Web Development Environment™ Rocket Software, Inc. wIntegrate® Rocket Software, Inc. Microsoft® .NET Microsoft Corporation Microsoft® Office Excel®, Outlook®, Word Microsoft Corporation Windows® Microsoft Corporation Windows® 7 Microsoft Corporation Windows Vista® Microsoft Corporation Java™ and all Java-based trademarks and logos Sun Microsystems, Inc. UNIX® X/Open Company Limited ii SB/XA Getting Started The above trademarks are property of the specified companies in the United States, other countries, or both. All other products or services mentioned in this document may be covered by the trademarks, service marks, or product names as designated by the companies who own or market them. License agreement This software and the associated documentation are proprietary and confidential to Rocket Software, Inc., are furnished under license, and may be used and copied only in accordance with the terms of such license and with the inclusion of the copyright notice.
    [Show full text]
  • Geek Guide > Beyond Cron
    GEEK GUIDE BEYOND CRON Table of Contents Ease of Use ..................................................................... 8 Multi-Server-Friendly .................................................... 10 Dependency Management ............................................ 13 Easy to Visualize ........................................................... 16 Delegation of Authority ................................................. 18 Management by Exception ........................................... 21 Flexible Scheduling ....................................................... 23 Revision Control ........................................................... 24 Conclusion .................................................................... 24 MIKE DIEHL has been using Linux since the days when Slackware came on 14 5.25” floppy disks and installed kernel version 0.83. He has built and managed several servers configured with either hardware or software RAID storage under Linux, and he has hands-on experience with both the VMware and KVM virtual machine architectures. Mike has written numerous articles for Linux Journal on a broad range of subjects, and he has a Bachelor’s degree in Mathematics with a minor in Computer Science. He lives in Blythewood, South Carolina, with his wife and four sons. 2 GEEK GUIDE BEYOND CRON GEEK GUIDES: Mission-critical information for the most technical people on the planet. Copyright Statement © 2015 Linux Journal. All rights reserved. This site/publication contains materials that have been created, developed or
    [Show full text]
  • Introduction to Cron - Goals
    Introduction to cron - Goals • Goals: – Understand how cron works – Understand crontab files – Understand our conventions 1 What is cron? • cron is a Unix daemon program • cron automatically runs programs at given times • cron is different from at, which is a queued batch job facility • We are moving to use cron for batch jobs, as opposed to at 2 Crontab files (Part 1) • Each user on each machine has a crontab file. • So, ecogdev has its own file on each of sid & soltrane, as does ecogdba. • This file consists of lines that look like this: 15 03 * * * /ecog/ecogdev/src/reports/timezone/timezoneauto 15 03 * * 0 /ecog/ecogdev/src/reports/swog_prots/swog_protsauto 30 0 * * * /ecog/ecogdev/bin/ftpschema 3 Crontab Files (Part 2) • Here is one line from a crontab file: 30 0 * * * /ecog/ecogdev/bin/ftpschema • Six fields on this line (* is a wildcard): – 1. Minute of the hour (0-59) – 2. Hour of the day (0-23) – 3. Day of the month (0-31) – 4. Month of the year (1-12) – 5. Day of the week (0-6 with 0=Sunday) – 6. Command line • Quiz: When does this job run? 4 Crontab Files (Part 3) • Here is that crontab line again: 30 0 * * * /ecog/ecogdev/bin/ftpschema • The rightmost field is the command line • Best to use absolute paths, as in this entry • Commands can be executable programs or shell scripts • Put #!/bin/csh at top of C Shell scripts 5 The crontab command • The crontab command allows you to install and edit per-user crontab files. • These are the installed crontab files.
    [Show full text]
  • Unix (And Linux)
    AWK....................................................................................................................................4 BC .....................................................................................................................................11 CHGRP .............................................................................................................................16 CHMOD.............................................................................................................................19 CHOWN ............................................................................................................................26 CP .....................................................................................................................................29 CRON................................................................................................................................34 CSH...................................................................................................................................36 CUT...................................................................................................................................71 DATE ................................................................................................................................75 DF .....................................................................................................................................79 DIFF ..................................................................................................................................84
    [Show full text]
  • Solaris Crontab - NCCCS Systems Office Wiki
    Solaris crontab - NCCCS Systems Office Wiki http://localhost:8000/NCCCS/solaris-crontab#preview Solaris crontab crontab Access Control Here is a quick cheat sheet on how to add a crontab for a non-root user on Solaris 8. The datatel user will require permissions to be added so it can add entries in the crontab. Users: Access to crontab is allowed: if the user's name appears in /etc/cron.d/cron.allow. if /etc/cron.d/cron.allow does not exist and the user's name is not in /etc/cron.d/cron.deny. Users: Access to crontab is denied: if /etc/cron.d/cron.allow exists and the user's name is not in it. if /etc/cron.d/cron.allow does not exist and user's name is in /etc/cron.d/cron.deny. if neither file exists, only a user with the solaris.jobs.user authorization is allowed to submit a job. Note that the rules for allow and deny apply to root only if the allow/deny files exist. The allow/deny files consist of one user name per line. A prompt of # means you are logged in as the root user. A prompt of $ means you are logged in as the datatel user. Quick one-liner to add entry # echo "datatel" >> /etc/cron.d/cron.allow How to verify # cd /etc/cron.d # pwd /etc/cron.d # cat cron.allow adm lp root datatel 1 of 2 9/27/2005 1:14 PM Solaris crontab - NCCCS Systems Office Wiki http://localhost:8000/NCCCS/solaris-crontab#preview # cat cron.deny daemon bin smtp nuucp listen nobody noaccess Copyright 2005 - J.
    [Show full text]
  • Running a PHP Script on a Regular Schedule Using Curl and Cron
    Running a PHP script on a regular schedule using curl and cron. Under normal circumstances a PHP script is only executed when someone requests it via the web by clicking on a link or typing the URL into the location bar. However, on occasion, you may want a script to do something at a regular interval instead – perhaps to rebuild a “daily graphic” or send nightly email. In these circumstances, you need to trigger the script using a different mechanism than random web access. That’s what this note is about. The following discussion assumes you have created a PHP script that performs the necessary actions when accessed via the web. In this case, that script is called “cron-demo.php” and is stored in a folder called “cron” off of the user’s root web folder (aka “public_html” on a UW server). [Note: real uw netids need to replace “uwnetid” in each of the three places it occurs below!] [public_html/cron/cron-demo.php] <?php // ---- EMAIL test script for PHP ------ $to = [email protected]'; $subject = 'Cron Test'; $message = 'Greetings from planet krypton where it is currently ' .date("l dS \of F Y h:i:s A"); $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); print" Script complete.\n"; ?> The next step is to create an operating system script (called a “shell script”) that uses an operating system utility called “curl” to access your PHP script via the web. This file is also stored in a folder called “cron” but located just off the user’s “normal” home or root folder (i.e.
    [Show full text]
  • Automating Admin Tasks Using Shell Scripts and Cron Vijay Kumar Adhikari
    AutomatingAutomating adminadmin taskstasks usingusing shellshell scriptsscripts andand croncron VijayVijay KumarKumar AdhikariAdhikari vijayvijay@@kcmkcm..eduedu..npnp HowHow dodo wewe go?go? IntroductionIntroduction toto shellshell scriptsscripts ExampleExample scriptsscripts IntroduceIntroduce conceptsconcepts atat wewe encounterencounter themthem inin examplesexamples IntroductionIntroduction toto croncron tooltool ExamplesExamples ShellShell The “Shell” is a program which provides a basic human-OS interface. Two main ‘flavors’ of Shells: – sh, or bourne shell. It’s derivatives include ksh (korn shell) and now, the most widely used, bash (bourne again shell). – csh or C-shell. Widely used form is the very popular tcsh. – We will be talking about bash today. shsh scriptscript syntaxsyntax The first line of a sh script must (should?) start as follows: #!/bin/sh (shebang, http://en.wikipedia.org/wiki/Shebang ) Simple unix commands and other structures follow. Any unquoted # is treated as the beginning of a comment until end-of-line Environment variables are $EXPANDED “Back-tick” subshells are executed and `expanded` HelloHello WorldWorld scriptscript #!/bin/bash #Prints “Hello World” and exists echo “Hello World” echo “$USER, your current directory is $PWD” echo `ls` exit #Clean way to exit a shell script ---------------------------------------- To run i. sh hello.sh ii. chmod +x hello.sh ./hello.sh VariablesVariables MESSAGE="Hello World“ #no $ SHORT_MESSAGE=hi NUMBER=1 PI=3.142 OTHER_PI="3.142“ MIXED=123abc new_var=$PI echo $OTHER_PI # $ precedes when using the var Notice that there is no space before and after the ‘=‘. VariablesVariables contcont…… #!/bin/bash echo "What is your name?" read USER_NAME # Input from user echo "Hello $USER_NAME" echo "I will create you a file called ${USER_NAME}_file" touch "${USER_NAME}_file" -------------------------------------- Exercise: Write a script that upon invocation shows the time and date and lists all logged-in users.
    [Show full text]
  • Linux Crontab: 15 Awesome Cron Job Examples
    Linux Crontab: 15 Awesome Cron Job Examples < An experienced Linux sysadmin knows the importance of running the routine maintenance jobs in the background automatically. Linux Cron utility is an effective way to schedule a routine background job at a specific time and/or day on an on- going basis. In this article, let us review 15 awesome examples of crontab job scheduling. Linux Crontab Format PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com MIN HOUR DOM MON DOW CMD Table: Crontab Fields and Allowed Ranges (Linux Crontab Syntax) Field Description Allowed Value MIN Minute field 0 to 59 HOURHour field 0 to 23 DOM Day of Month 1-31 MON Month field 1-12 DOW Day Of Week0-6 CMD Command Any command to be executed. 1. Scheduling a Job For a Specific Time The basic usage of cron is to execute a job in a specific time as shown below. This will execute the Full backup shell script (full-backup) on 10th June 08:30 AM. Please note that the time field uses 24 hours format. So, for 8 AM use 8, and for 8 PM use 20. 30 08 10 06 * /home/ramesh/full-backup 30 – 30th Minute 08 – 08 AM 10 – 10th Day 06 – 6th Month (June) * – Every day of the week 2. Schedule a Job For More Than One Instance (e.g. Twice a Day) PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com The following script take a incremental backup twice a day every day.
    [Show full text]
  • BASH Programming − Introduction HOW−TO BASH Programming − Introduction HOW−TO
    BASH Programming − Introduction HOW−TO BASH Programming − Introduction HOW−TO Table of Contents BASH Programming − Introduction HOW−TO.............................................................................................1 by Mike G mikkey at dynamo.com.ar.....................................................................................................1 1.Introduction...........................................................................................................................................1 2.Very simple Scripts...............................................................................................................................1 3.All about redirection.............................................................................................................................1 4.Pipes......................................................................................................................................................1 5.Variables...............................................................................................................................................2 6.Conditionals..........................................................................................................................................2 7.Loops for, while and until.....................................................................................................................2 8.Functions...............................................................................................................................................2
    [Show full text]
  • Linux Shell Scripting Cookbook Second Edition
    Linux Shell Scripting Cookbook Second Edition Over 110 practical recipes to solve real-world shell problems, guaranteed to make you wonder how you ever lived without them Shantanu Tushar Sarath Lakshman BIRMINGHAM - MUMBAI Linux Shell Scripting Cookbook Second Edition Copyright © 2013 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: January 2011 Second edition: May 2013 Production Reference: 1140513 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78216-274-2 www.packtpub.com Cover Image by Parag Kadam ([email protected]) Credits Authors Project Coordinator Shantanu Tushar Shiksha Chaturvedi Sarath Lakshman Proofreader Reviewers Linda Morris Rajeshwari K. John C. Kennedy Indexer Hemangini Bari Anil Kumar Sudhendu Kumar Production Coordinator Aravind SV Shantanu Zagade Acquisition Editor Cover Work Kartikey Pandey Shantanu Zagade Lead Technical Editor Ankita Shashi Technical Editors Jalasha D'costa Amit Ramadas Lubna Shaikh About the Authors Shantanu Tushar is an advanced GNU/Linux user since his college days.
    [Show full text]
  • LFCS Exam Name: Linux Foundation Certified System Administrator
    Vendor: Linux Foundation Exam Code: LFCS Exam Name: Linux Foundation Certified System Administrator Version: DEMO QUESTION 1 What is the output of the following command? echo "Hello World" | tr -d aieou A. Hello World B. eoo C. Hll Wrld D. eoo Hll Wrld Answer: C QUESTION 2 Given a file called birthdays containing lines like: YYYY-MM-DD Name 1983-06-02 Tim 1995-12-17 Sue Which command would you use to output the lines belonging to all people listed whose birthday is in May or June? A. grep '[56]' birthdays B. grep 05?6? birthdays C. grep '[0-9]*-0[56]-' birthdays D. grep 06 birthdays | grep 05 Answer: C QUESTION 3 Which keyword must be listed in the hosts option of the Name Service Switch configuration file in order to make host lookups consult the /etc/hosts file? Answer: files QUESTION 4 Which command can be used to delete a group from a Linux system? A. groupdel B. groupmod C. groups D. groupedit Answer: A QUESTION 5 How many IP-addresses can be used for unique hosts inside the IPv4 subnet 192.168.2.128/28? (Specify the number only without any additional information.) Answer: 14 QUESTION 6 What is the purpose of the command mailq? A. It fetches new emails from a remote server using POP3 or IMAP. B. It is a multi-user mailing list manager. C. It is a proprietary tool contained only in the qmail MTA. D. It queries the mail queue of the local MTA. E. It is a command-line based tool for reading and writing emails.
    [Show full text]
  • Unix Scripts and Job Scheduling
    UnixUnix ScriptsScripts andand JobJob SchedulingScheduling Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh [email protected] http://www.sis.pitt.edu/~spring OverviewOverview Ü Shell Scripts Shell script basics Variables in shell scripts Korn shell arithmetic Commands for scripts Flow control, tests, and expressions Making Scripts Friendlier Functions Pipes and Shell Scripts Scripts with awk and/or sed Ü Job Scheduling bg and at cron RunningRunning aa ShellShell ScriptScript Ü First three forms spawn a new process, so new variable values are not left when you return sh < filename – where sh is the name of a shell – does not allow arguments sh filename filename – Assumes directory in path – Assumes chmod +x filename . filename – Does not spawn a new shell. – Changes to system variables impact the current shell Ü you may exit a shell script by Getting to the last line Encountering an exit command Executing a command that results in an error condition that causes an exit. StructureStructure ofof aa ShellShell ScriptScript Ü Basic structure #! Program to execute script # comment Commands and structures Ü Line continuation | at the end of the line is an assumed continuation \ at the end of a line is an explicit continuation Ü # in a shell script indicates a comment to \n Ü Back quotes in command cause immediate execution and substitution DebuggingDebugging aa scriptscript Ü Use the command set –x within a script Ü You can also activate the following set options -n read commands before executing them – for testing scripts -u make it an error to reference a non existing file -v print input as it is read - disable the –x and –v commands Ü Set the variable PS4 to some value that will help – e.g.
    [Show full text]