Skip to content

A mixed week with minor tweaks

As previously mentioned I was looking to package pwsafe for Wheezy, as this is one of the few tools that I rely upon which isn't present.

There are now packages available, with the source on github.

I've also been doing some minor scripting because I've run into a few common problems recently:

run-parts

run-parts is a simple utility which will run every executable in a directory, more or less.

In Debian-land run-parts is the mechanism for /etc/cron.daily and /etc/cron.hourly - and that is where I've had problems recently.

Imagine you run a backup via cron.daily. Further imagine that you run a post-backup rsync and that this might take many many hours. If your backup takes >=24 hours you're screwed.

To that end I've patched my run-parts tool to alert and exit if a prior invocation is still running.

silent-run

I think everybody has this script - hide all output when running a command, unless the command fails. Looking today I see chronic from Joey's excellent moreutils does this. D'oh.

I think I've done more, but I cannot remember. In conclusion software is both easy and hard - easy because these two trivial changes were within my reach, but hard because years after encountering GNU/Linux we still have to add in the missing pieces.

Still could be worse, I spent four/five hours yesterday evening fighting with MS-SQL server, and that is time I'm never going to get back.

Comments On This Entry

  1. [author] Steve Kemp

    Aye that'd work. The appeal of the patched package is that I get this behaviour for free for all cron-jobs executed via run-parts via just a package upgrade.

    That's simpler than editing /etc/crontab, or per-user crontabs.

    Automation over all!

  2. [gravitar] Jim

    I make my crontab entries look like:

    flock -nx /tmp/cron-backup.lock chronic backup-command.sh
  3. [gravitar] Anonymous

    (Note to the other commenter: don't put lockfiles in /tmp. Use your home directory for personal scripts and /var/lock for system scripts.)

    The downside of doing the locking in run-parts: if one cronjob takes too long, all cronjobs don't get run again. Not true if you do per-entry locking.

    If you want more automation, and adding a flock invocation to each script bugs you, why not add support for a run-parts.conf, which can set a wrapper command to run around each individual script? Then you could drop in a run-parts.conf that runs every command inside a separate flock (keyed off of the command to run).

  4. [gravitar] foo

    Why don't you put pwsafe in sid and then upload it to wheezy-backports (which is open right now)?

  5. [author] Steve Kemp

    I'm not a Debian developer, so I cannot upload to sid.

    (Sponsorship could work, but ...)

  6. [author] Steve Kemp

    Using a prefix-wrapper is a good idea, thanks. I could do that then use with-lock automatically.

  7. [gravitar] foo

    You used to be a Debian member. Your status is emeritus since I guess you retired gracefully. This means that you can very easily re-join Debian and get upload access again. Please see the devref for info, its very simple (GPG sigs, send 1 email, minimal re-check of skills). You could be a member again in a couple of days/hours.

    https://db.debian.org/search.cgi?uid=skx&dosearch=Search
    https://nm.debian.org/public/person/skx
    http://www.debian.org/doc/manuals/developers-reference/developer-duties.html#returning

  8. [author] Steve Kemp

    Indeed, but I left due to lack of time, and that hasn't changed.