Wednesday, October 17, 2007

OPS435W7 Review

OPS435 Review for Test 1

0090
1016

If you r a linux administrator, so you will have many tasks to perform and going, for instance we would be doing back ups when your doing a weekly backup what time would you choose to do the backup, middle of the night on the weekend, you use the chron deamon to schedule your job, three items to make this up chron d, it’s a utility that always runs in the background, it continuously going and looks for certain files, and if it finds any jobs ready to be executed it will process the job, the files names it looks into are called /etc/chrontab every user that allowed to use it has their own chron file,the chron deamon looks into top this how do you create one of the files, you use a command called chron tab, and is located /usr/bin/chrontab…..bin stands for binary, chron tab and chrontab file, this is the command you use to edit this file and once you have this file the crond looks into the file to get the jobs done, some of the other items associated to this is /var/spool/cron/allow, the admin is allowed to use the chrontab file, no one else is allowed to do that, but if the superuser wants to allow other people you go into the chrontab to add the users to use the file to do the jobs, theirs also another file called /var/spool/cron/deny this is your not allowed to do it, you can only use one of these files.

/etc/chrontab files contain the jobs,

The other files on the slide are used by the deamon,

How do you set up a job to be run, the information you put in the chron tab file, has to have a certain format, that’s how the deamon what you are suppose to do, this file contains 6 fields, minute, hour, date, month, day, command string, you can have the month in numerical or three letter format, small letters or capital letters or in cap followed by small, only in these three types

Day of the week, you again can specify it in numeric or text, it works like this, 0-6, 0=Sunday, some can be 0-7 which 7 can be Sunday, always use zero.

The last and 6th field is the command itself, what you want to do at that time, lets say we want to do a backup and we want it done at 2:38 on a Sunday morning, on the first 10th 20 and 30 of the month and the month is October, day of the week either Sat or Sun

38 2 10,20,30 10,OCT 6,Sun /bin/backup

Couple of special chars that are used in the chron tab file, lets say any month, how do you normal say everything, if you put a * where the month is it will be anything, another one is / its not a divider but a repeater.


Also lets say when you do any linux command stn output and stn error, you are going to be doing this 2:30 in the morning are you going ot be their no so you wouldn’t want it going on the screen, the default location, where would you like it to go, somewhere where you wanna see it immediately, stnout and stnerror goes to mail, so matter where you are you are going to get it by mail, if you want it to go somewhere else you redirect it to somewhere else, you redirect it from mail to go anywhere else. The default is mail.

• every minute of every hour of every month of every weekday
• * * * * * * who | grep ‘^evil ’

Run a script every odd hour
0 ½ * * 1-5 /home/bob/script

The chrong tab is created by the chrontab command if you execute this command
Chrontab
-e = edit
Take the contents of the file and put it in a vi buffer, by using vi you can makes changes if you don’t have it, it will open a new buffer in vi and you can enter in commands, and when you finish :wq once you do this, it will take a look at what you have done, and if any mistakes where their it will tell you line so and so and do you want to go back and edit, you say yes and you can go back and edit it. Only when u have everything correct it will accept it and save it in to the chron tab file

-r = delete or remove
-l = inside the file, list the contents of the file
-u [ username ]= only used by the super user can do anything to anything to anyone’s chron tab file

23-7/2
11 at night to 7 in the morning then
Every two after aftwareds

8 PAGES wrong, half multiple choice, 20 q for 20 marks

2nd part shell basics, it will contain, the 9 steps of the shell, all the special chars its looking for, you should know all the special chars of the shell interprets the one that we have covered also

Variables mix and matrch and do anything

Commands and utilities, do something then figure out what commands you put together to accomplish the objective,

Even a bonus, a couple,

The only difference between this, the other questions part marks, the bonus no part marks they work or not

Interpret the script run it and what you see on the screen.
For a total of 70 marks + 5 bonus marks


CUT –F 1-6 a*b* c?t

$0 – positional character, the file ur running
$? – exit status of last command
&& - if $? Is 0 then it is successful then go on
|| - other way around $? Is 1 then go on
“ $ ‘ \ “

\ = single character quote the char following me is not a special char
Echo ààà
Echo $(a) erroràà

Tr [A-Z] [a-z] | tr –d ‘.,’ > b

Tr “” “\n” < a

Tr “ “ “\n” < a |tail -2|head -1

Walk through keep track of all the variable contents, the vars will change, and if you don’t keep track you will loose what the values were, when you do walk through, in pencil and pen do all the variable contents as you go through each command and number 2 you have to know your commands, you will have to interpret the commands review commands and keep track of all the values,

No comments: