Project 3: A Friendly Daemon

Due Wednesday, December 13, at noon (Start of the final exam)

On Unix-like systems, including Linux, long-running processes are called daemons (always spelled with the a). The name is a reference to Maxwell's Demon, which in the Wikipedia article, is spelled without an a. Regardless of spelling, quite a few long-running background processes exist on any operating system.

For this assignment, write a daemon which will notice when you log in, as well as message other users when they log in if you have a message for them. The daemon should periodically check to see if you have logged in, and if you have, send you a greeting. Once per minute is a reasonable frequency here, particularly since the command "last" supports minutes well. Note that "once per minute" is the frequency of checking. Only send one message in response to each new login! Otherwise it will be very annoying. In addition to checking for you, the daemon should look at the contents of a directory in your home directory named ".outgoing", which will contain messages for other users. Each file in .outgoing should be the name of another user, and the contents should be a message for that user. If the user is currently logged in, the daemon will send them the contents of the file, and delete the file so the message is not sent again. Specifics you might find useful: