Code Snippets

Backup KeepNote Script For Backtrack Linux

I take a lot of notes when I am either working on projects or researching so in Backtrack Linux I use KeepNote to accomplish this. KeepNote is a great little note application that provides notebook and tab functionality which pretty much covers what I need to do. One thing KeepNote doesn’t offer right out of the box is an easy way to backup notes from the command line so I took another backup shell script and converted it to backup KeepNote notes on Backtrack.

Technology Insights

Ubuntu Equivalent Of yum whatprovides On CentOS

In the past I used CentOS Linux the open source RedHat Enterprise Linux clone but these days I find myself using Ubuntu Linux more and more often because so many more packages that clients want installed are more up to date. One command I used to use on CentOS all the time was the yum whatprovides command which would allow me to search for specific applications, scripts, libraries, etc. to figure out what packages I needed to install. The command that is similar on Ubuntu is apt-file which does not come installed by default. Below I show the output of an example yum whatprovides command on CentOS Linux followed by what needs to be done to use apt-file on Ubuntu Linux.

Code Snippets

RightScale RightScript To Add SSH Users To Linux Nodes On Boot

The below code snippet was used to add SSH users to RackSpace cloud CentOS Linux nodes being used as application servers and managed via RightScale. The SSH users were required during a testing phase so they could look through logs and make modifications to specific configuration files, etc. There are three things that have to happen to create the SSH user, allow them to login, and provide them the necessary rights on the server to accomplish their tasks which include adding the user, modifying the sshd config to allow password logins, and update the sudoers file to enable sudo access for wheel group users.

Code Snippets

Restart Services On RackSpace Managed Nodes That Require sudo Rights

Recently I was working on a project that was using RightScale to manage RackSpace cloud nodes. One of the requirements of the project was to have application nodes scale automatically thus they were required to automatically install software, configure settings, and start services automatically on the RackSpace CentOS nodes being used. Most everything was fairly straight forward however some of the services we were using would not start properly and initially because of the lack of logging from the services we were unable to figure out what the problem was. Below I describe the problem in more detail along with the solution which involved updating a configuration file on the CentOS Linux servers and then restarting the services.

Code Snippets

Represent A Tab When Using sed Find/Replace

The other day I needed to create a RightScript shell script that would update a couple configuration files on a server that was being launched in the RackSpace Cloud via RightScale. I decided to use SED to find and replace content within the configuration files. The first pass at the script failed because what I thought were spaces ended up being tabs. Use the information below to represent a tab within a shell script when using sed.