Quiz 4 (Due in or before class, 5th week)

(Remember: your shell is not "sh", please type "sh" or "bash" before attempting any of the interactive examples from the text.)

Question 1: Shell programming 1
Use the template newuser script (and see getopts(1) for more info) to make a shell script for adding user accounts. Use the add_user_to_passwd script to actually edit the password file. Read it, but you don't need to write a different script to edit the passwd file. Make your script take flags (-s sponsor_name, -x, -p, -c crypt_string) corresponding to whether the account should be given the password of the sponsor (-s sponsor_login), an "x" for the password (-x), whether it should put an "x" in the password, then run "passwd(1)" (-p), or whether it should take an already encrypted password (-c crypt_string). Example interactions should look like this. Your script should also make the users home directory. Test it out on the Linux machines in the Lab.

Question 2: Shell programming 2
Write an init.d script to start a webserver (if you aren't taking webservices this quarter, let me know and I'll give you a different service to start and stop). Check to see if there is a /var/lock/subsys directory and take appropriate action if there is (remember redhat?).