Linux Journal Scripting Games?
For those of you who were unhappy that Script Frenzy was not about writing scripts but about writing...well...scripts, here is something to entertain you...The 2010 Scripting Guy Games! Huh? Windows? Um...
OK, yes the Scripting Guy Games are for Windows. But what if we did it for Linux. What sort of meaty script challenge could we come up with? Certainly something more challenging than determining the time or reading the registry. Here are some thoughts, with apologies to the Scripting Guy(s) for stealing their format.
Day 1: Beginner: Create a script to add a user to the system, provision their mail, IM, shares and home page.
Day 1: Advanced: Create a script to add a new system to the infrastructure, provision it and bring it on line without manual configuration.
Day 2: Beginner: Create a script to deprovision a departing user account, back up their files and move them off into storage.
Day 2: Advanced: Create a script to migrate an high-availability web cluster with MySQL database to new hardware, provisioned using the script from Day 1.
All four of these tasks were ones that I got hit with about two days into a job several years ago. The fun part was that we had to use basic shell commands. We did not have perl installed on the systems for security reasons, and we did not have ruby, or python or any of those wonderful tools. Just a bare bones installation of the kernel and bash (although feel free to use your shell of choice...ksh anyone?) - the tools needed to do the job at hand.
So, what do you think? Are you up to the challenge? Maybe we should set up a Scripting Gurus help and trade area on the site! Hmm...did I just hear our beloved webmistress whimper?
David Lane, KG4GIY is a member of Linux Journal's Editorial Advisory Panel and the Control Op for Linux Journal's Virtual Ham Shack
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- seo services in india
3 hours 23 min ago - For KDE install kio-mtp
3 hours 24 min ago - Evernote is much more...
5 hours 24 min ago - Reply to comment | Linux Journal
14 hours 10 min ago - Dynamic DNS
14 hours 44 min ago - Reply to comment | Linux Journal
15 hours 42 min ago - Reply to comment | Linux Journal
16 hours 32 min ago - Not free anymore
20 hours 34 min ago - Great
1 day 21 min ago - Reply to comment | Linux Journal
1 day 30 min ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
A couple challenges
Here's one that's almost as trivial as the Scripting Guy's exercises.
Beginner: Take as input a list of tab-separated values. One column of this input will be numeric. Sort the list by the numeric column in ascending value and output the sorted list.
Example input:
Example output:
Advanced: Same task, but the number of numeric columns is unknown. You may assume that each column contains either text or numbers, but not a mix of both (unless you go for the third extra points goal). The script must exit with an error if no numeric column is found. If multiple numeric columns exist, prompt the user for which one to sort by.
This one is more involved, but accomplishes a more useful task.
Beginner: You have a directory hierarchy full of files that may have odd filenames (mixed case, spaces and other special characters). Create a script to copy these files to another location while maintaining the directory structure, changing all names so they only use the letters a through z (lowercase), numerals, period, underscore, and hyphen. The first character of any filename or path component may not be a hyphen. The script must avoid filename collisions (e.g., if the original directory contains foo.txt and FOO.TXT, these files must both end up in the new hierarchy and have different names).
Advanced: Same task, with the added constraint that the script must maintain the file extension (e.g., foo.txt and FOO.TXT can become foo.txt and foo_2.txt, but not foo.txt and foo.txt_2). Also, generate a list on standard output of the old filenames mapped to the new ones.
I keep meaning to try these.
I keep meaning to try these. I know how I would go about doing them. I love awk so I'd do something like this for the first beginners challenge (off the top of my head)...
#! /bin/bash awk '{print $2, $1, $3}' inputfile | \ sort | \ awk '{printf("%s\t%s\t%s\n", $2, $1, $3)}'Re: I keep meaning to try these.
That's very close to working on the example. But awk by default splits on any whitespace, not just tabs, so "passion fruit" would be split into two fields (hint: check out the FS variable or -F option).
Actually, you could rewrite your script to remove awk entirely if you used the -k option of sort.
However, one thing I didn't make explicit (how tricky of me :-) in describing the first exercise is that you don't know which column is the numeric one. Here's another possible input:
And the correct output:
Your script needs to somehow figure out which column is the numeric one. I hadn't thought of using awk to do this, but since you brought it up, I think it would work nicely for that job. Happy scripting!
(P.S. I don't know how long comments stay open, so if you want to reach me directly you can do so at vkochend at nyx.net).
i would love that, but i
i would love that, but i would go with different challenges
Challenges
I just pulled something off the top of my head as the challenge...that being said, what sort of challenges would you like to see?
David Lane, KG4GIY is a member of Linux Journal's Editorial Advisory Panel and the Control Op for Linux Journal's Virtual Ham Shack
well, your ideas seem to be
well, your ideas seem to be centered towards setting up a network. every network is different, therefore, it would be difficult to judge scripts based on a specific network. i would also go with something other than setup. but that's just my opinion.
I am up for that :)
I am up for that :)
Sounds like a great idea
This sounds like the kind of thing I'd really enjoy. Be very interested in getting involved if something like this came about.
why?
why? there are literally hundreds of well established sites doing this already. support them rather than invent the wheel again.
Because...
it would be fun.
If you don't agree,then...
Sounds like fun
Sounds like heaps of fun.
I really don't need another distraction from my uni assignments at the moment, which have their own programming involved, but I'm definitely up for some scripting :-).
--
Regards,
Matthew Cengia
This would be awsome. I'm no
This would be awsome. I'm no guru but I'd love to help.