ONLY ProfessionalSolutions

profileCoolcaliber
linuxassignment4.zip

linux assignment 4/outline.pdf

10/23/2017 Untitled Document

https://uml.umassonline.net/bbcswebdav/pid­916185­dt­content­rid­4615039_1/courses/INFO.3120.061.FA17/mail­message­project­outline.html 1/1

Outline of Project 4

 

If there are no position parameters (usernames) listed on the command line    then    print an error message    exit the script     endif 

get the real name of the user running the script ($USER) from field 5 of the password file  and remember that when you look in the password file you must exactly match field 1 or if you are  using NIS, then you must exactly match the username 

Also remember that you can get false positive matches if you are not careful. For example  say you had these usernames maryjane, mary, and maryann, and you were were looking for mary, if your  matching is not right, you may also match maryjane and maryann 

for each username listed from positional parameters      do      if the username exists in the password file or NIS password (see note above about maching)      then      if the username is logged in (see not above about matching)        then          send the mail message        else           print a message that the username is not logged into the system         endif    else      print a message that the username does not exist      endif 

    done   

linux assignment 4/Programming Assignment 4.docx

Programming Assignment 4

Follow the my shell programming guidelines as in the other assignments.

Write a shell script to send a customized mail message to the users listed on the command line by login (user) name, only if they are currently logged on.

· If no users are listed on the command line an error message should be printed.

· In the mail message, you should use the full (real) name from the passwd file (/etc/passwd).

· You also need to sign the script with the real name of the person who is running the script.

·

. This can be derived from the $USER environment variable and looking up the value in the password file.

· An error message should be printed if the user does not exist in the passwd file or in NIS (YP)

· The password information on cybserver.uml.edu is stored in NIS (Yellow-Pages YP). 

. You can use  ypmatch<username>  or  ypcat passwd to get the information

· On ce.uml.edu,  the information is both in /etc/passwd or can be extracted in the manner listed above.

· PLEASE ONLY SEND THIS MESSAGE TO USERS WHICH YOU KNOW PERSONALLY. 

·

. You can always use yourself and me (mrichard) as a test case

. The real name of the user of the script should only be computed once.

· A "Here-Document (In-Line Redirection)" must be used for the mail message. 

· No temporary files shall be used.

The message should be as follows:

Hello <INSERT THE USERS REAL NAME FROM THE PASSWORD FILE>,

**** This email is automatically generatated by <username of the person running the script>  ******

My instructor requires that I send this message as part of an assignment for class 92.312. The current time and date is <insert the date/time when the script is executing>.

Have a nice day.

<insert the real name of the person running the script - do not hard code the value>