This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:spring2014:unix:projects:dataproc [2014/03/23 21:06] – [Task 1: Obtain irc bot] wedge | haas:spring2014:unix:projects:dataproc [2014/03/23 21:29] (current) – [Submission] wedge | ||
---|---|---|---|
Line 12: | Line 12: | ||
=====Background===== | =====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. | + | Often times, we will find ourselves encountering data in a slightly one-off format- not quite meeting some requirement we need for further processing. |
- | With automation, comes the need to do things outside that interactive | + | Luckily, the UNIX environment |
- | We will be scheduling tasks with respect to time in this project, | + | This activity has you dabbling |
- | =====cron===== | + | =====Task 0: Post/ |
- | From the wikipedia article on [[wp> | + | * Because |
- | + | * Please do not give away any answers | |
- | "Cron is a time-based job scheduler in Unix-like computer operating systems. The name cron comes from the word " | + | |
- | + | | |
- | 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 get credit, your response can**not** be to one of your own questions. |
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | * A question | ||
=====Task 1: Obtain source code===== | =====Task 1: Obtain source code===== | ||
Line 116: | Line 121: | ||
</ | </ | ||
+ | NOTE: Copying/ | ||
=====Task 3: Execute your program===== | =====Task 3: Execute your program===== | ||
Line 130: | Line 136: | ||
* Ignoring the index values in the left-most column, determine which numerical codes occur more than once by concocting a command-line incantation or script that appropriately filters and processes the output. | * Ignoring the index values in the left-most column, determine which numerical codes occur more than once by concocting a command-line incantation or script that appropriately filters and processes the output. | ||
* Also display with a count of the total number of lines in the output, along with the total number of lines with valid numeric values (ignore " | * Also display with a count of the total number of lines in the output, along with the total number of lines with valid numeric values (ignore " | ||
- | * Put your resulting command-line(s) or script in a file called **task5.txt** | + | * Put your resulting command-line(s) or script in a file called **task5.sh** |
* Put the output (result) of your command-line(s) or script in a file called **task5.out** | * Put the output (result) of your command-line(s) or script in a file called **task5.out** | ||
Line 166: | Line 172: | ||
* Sorts the resulting numeric data according to the value to the left of the dash. | * Sorts the resulting numeric data according to the value to the left of the dash. | ||
* Re-indexes the data to create a new, more refined, data file. Have a single tab separate the index value from the data value on each line. | * Re-indexes the data to create a new, more refined, data file. Have a single tab separate the index value from the data value on each line. | ||
- | * Put your logic in a file called **task6.txt** | + | * Put your logic in a file called **task6.sh** |
* Put your output in a file called **task6.out** | * Put your output in a file called **task6.out** | ||
- | =====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, | ||
- | |||
- | * irc handles are limited to 9 characters max (and they may not like starting with numbers or having spaces in them) | ||
- | * the irc server you want to connect to is: **irc.offbyone.lan** (port 6667 if it matters) | ||
- | * you may want to initially configure your bot to join a secluded channel so you can test it. For the project, it will ultimately need to join: **# | ||
- | * you should configure both yourself and me (username **wedge**) as administrators for the bot. | ||
- | |||
- | 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/ | ||
- | 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, | ||
- | |||
- | * phenny-games | ||
- | * oblique | ||
- | |||
- | 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: | ||
- | |||
- | * ps | ||
- | * grep | ||
- | * pgrep | ||
- | |||
- | 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: | ||
- | |||
- | * ps | ||
- | * grep | ||
- | * pgrep | ||
- | * kill | ||
- | * pkill | ||
- | |||
- | 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===== | =====Submission===== | ||
Line 228: | Line 179: | ||
* All criteria indicated above | * All criteria indicated above | ||
- | * To signal completion, submit an archive containing the following | + | * To signal completion, submit an archive containing |
- | * botcheck script (call it **botcheck.sh**) | + | * Task 0: **task0.question** and **task0.response** |
- | * botkill script | + | * Task 1: **task1.txt** |
- | * a text file called (**at.txt**) containing syntax used to create/ | + | * Task 2: **task2.txt** |
- | * a listing of your crontab entries (**crontab.txt**), showing the correctly scheduled deployment of your script | + | |
- | * a copy of your configured bot's config file (**config.py**) | + | * Task 4: **task4.txt** |
- | * a text file containing the URL you downloaded your bot, along with any URLs you obtained modules/ | + | * Task 5: **task5.sh** and **task5.out** |
- | * Put all these files in a **tar** archive | + | * Task 6: **task6.sh** and **task6.out** |
- | * Compress it with max compression using **bzip2** | + | * Put all these files in a **tar** archive |
- | * Name the archive **ircbot.tar.bz2** | + | * Compress it with max compression using **gzip** |
- | * After you've recorded the crontab entry with your botcheck script, remove the entry from your crontab (so we don't end up with a bunch of phantom bots nobody cares about). | + | * The resulting |
- | * When you're done with this project, kill your bot. Do not leave it running. | + | |
- | + | ||
- | **NOTE:** If this activity fascinates you and you'd like to keep playing with your bot, do so using a different config/ | + | |
To submit this project to me using the **submit** tool, run the following command at your lab46 prompt: | To submit this project to me using the **submit** tool, run the following command at your lab46 prompt: | ||
<cli> | <cli> | ||
- | $ submit unix dataproc | + | $ submit unix dataproc |
Submitting unix project " | Submitting unix project " | ||
- | -> ircbot.tar.bz2(OK) | + | -> dataproc.tar.gz(OK) |
SUCCESSFULLY SUBMITTED | SUCCESSFULLY SUBMITTED |