Shell Scripts

As part of our programming services, softwareAB consultants end up doing quite a bit of shell programming for our clients. We hope the following scripts are useful for you.

Here are the scripts we have loaded for your perusal:


Run commands in background

You can download the scripts here. The zipped image contains a README with installation information.

Here's the problem: You are connected to a remote network using SSH and you run a command at the prompt (maybe a CVS update). Then the network connection drops and you realize that your command was terminated in the middle of doing its work. When you reconnect to the remote system, you have to start the command again.

This problem has a simple solution (nohup) and these scripts provide an easy interface. Just ensure that these scripts are in the system path on your remote system and use them to ensure that your long- running commands aren't at the mercy of network timeouts anymore.

Here's an example of the scripts in action running the ls command. Admittedly, this is a lame example but it demonstrates the usage well enough. run_cmd example


Cygwin CVS Helper Scripts

You can download the scripts here. The zipped image contains a README with installation information.

Over the course of many years, softwareAB has designed and implemented multiple build configuration modules. These modules ensure that a software project or product can be recreated reliably and that the development cycle is well-controlled and efficient.

For Windows development, we use the Cygwin project (http://www.cygwin.com/). This is a complete development and shell environment for Windows that provides a full set of UNIX-like tools and commands. While we don't use the provided gcc compiler very often to develop software (our Windows-based clients focus on Microsoft .NET), we use the UNIX-emulation environment extensively.

The Cygwin project includes a reasonable version of CVS. While not every possible protocol is supported (for example, the :sspi: Windows protocol is not), the CVS port has never lost any data for us! Plus, it's easy to get secure remote access by using the SSH protocol (:ext:).

There is an NT-specific version of CVS (http://www.cvsnt.com/cvspro/) which we have had problems integrationg with CVS. Therefore, we use the Cygwin CVS port both for client and server.

The biggest problem with the Cygwin CVS is that NT permissions aren't handled well. In a multi-user team environment, commits by one developer had the unfortunate effect of removing access permissions for other developers even to read the repository files in question. Enter our CVS helper scripts. The most complex script is the reset_perms.sh (which must be customized to your local system). This script is invoked by the loginfo CVS administrative script and ensures that NT permissions are set correctly for the files just modified.

When you download the package, you'll see references to the SetACL.exe application. This is a way-cool tool available at http://setacl.sourceforge.net/. We reference this tool to reset the actual NT permissions.

We have also included a couple of scripts that demonstrate techniques that newbies are always asking, such as "How do I verify that a log message meets our site requirements" and "How can I control whether a user can commit changed files".