Table of Contents

Corning Community College

CSCS1730 UNIX/Linux Fundamentals

~~TOC~~

Project: IRC BOT

Objective

To gain some familiarity with the task scheduling facilities on the system while exploring the obtaining, configuring, and deployment of a piece of software.

Background

To most of us, computers are a frequently used interactive tool for accomplishing work. With our recent explorations into the realm of shell scripting, concepts of automation are starting to enter our peripherary.

With automation, comes the need to do things outside that interactive environment, and run at a designated time or in reaction to a particular event.

We will be scheduling tasks with respect to time in this project, to get better acquainted with the functionality and capabilities of non-interactive yet automated tasks.

cron

From the wikipedia article on Cron:

“Cron is a time-based job scheduler in Unix-like computer operating systems. The name cron comes from the word “chronos”, Greek for “time”. Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration, though its general-purpose nature means that it can be used for other purposes, such as connecting to the Internet and downloading email.”

Be sure to check the manual page for cron(8), and the corresponding manual pages for crontab(1) and crontab(5). When you are familiar with where pertinent information can be found regarding cron, proceed to the question below.

Task 1: Obtain irc bot

There exist a number of irc bots, consisting of varying features and complexities. To facilitate your task, I would recommend the using of Phenny (or a clone), which tends to be simpler to deploy than its more configurable counterparts.

So, via the proper means:

Task 2: Configure irc bot

An irc bot, being a network-aware piece of software, needs sufficient configuration in order to operate properly. While it is up to you to derive a working configuration, you'll want to keep in mind the following information:

Verify you can successfully start the bot and that it connects to the intended server and channel. You may want to run it in a sub-console in your screen session, so that you can keep an eye on any messages it generates.

Task 3: Enhance the bot with modules/plugins

In addition to core usability, I'd like you to enable additional functionality through the use of modules. A few modules come with the stock Phenny software distribution, and there appear to be a few third-party sources, such as:

Install and enable modules for your bot, and verify some form of functionality.

NOTE: Due to changes in the service it uses, the Phenny weather module is beyond broken. Trying to use it will result in an error being displayed. If you are skilled with Python and can craft a solution, that can certainly count toward completing this task of the project.

Task 4: Script to check bot status

Using tools and concepts we learned previously, especially:

Write a script that checks for a currently running Phenny instance (run by you). If not instance is found, launch a new instance. If an instance IS running, do nothing.

Be sure to make use of absolute paths.

Task 5: Script to kill running bot

Using tools and concepts we learned previously, especially:

Create a script that will check for a currently running Phenny instance (run by you). If an instance is running, kill it.

If no instance is running, do nothing.

Task 6: Create a cron job

Reading up on cron and figuring out how to add an entry to your user's personal crontab, add a job that runs your check script (Task 4 script) every 10 minutes.

You can verify successful cron job deployment by ensuring your bot is not running and waiting for the next 10 minute marker and see if it starts.

Task 7: Create an at job

While cron is used for long-term scheduled jobs, at is useful for short term ones.

Read up on at, and deploy an at job that will run your botkill script (task 5) a couple minutes before a 10 minute marker.

Use this to test both your script and correct usages of at, as well as the cron-related activities.

Submission

To successfully complete this project, the following criteria must be met:

NOTE: If this activity fascinates you and you'd like to keep playing with your bot, do so using a different config/handle, so it will not be confused with your project submission. If you want to schedule it, do so using a differently named script at a different time interval).

To submit this project to me using the submit tool, run the following command at your lab46 prompt:

$ submit unix ircbot ircbot.tar.bz2
Submitting unix project "ircbot":
    -> ircbot.tar.bz2(OK)

SUCCESSFULLY SUBMITTED

You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.