About Archive Tags RSS Feed

 

A mixed week with minor tweaks

13 April 2013 21:50

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.

| 8 comments

 

Comments on this entry

icon Jim at 18:15 on 13 April 2013

I make my crontab entries look like:

flock -nx /tmp/cron-backup.lock chronic backup-command.sh
icon Steve Kemp at 18:53 on 13 April 2013
http://steve.org.uk/

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!

icon Anonymous at 23:31 on 13 April 2013

(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).

icon foo at 01:42 on 14 April 2013

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

icon Steve Kemp at 09:28 on 14 April 2013

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

(Sponsorship could work, but ...)

icon Steve Kemp at 15:14 on 14 April 2013
http://steve.org.uk/

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

icon foo at 02:54 on 17 April 2013

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

icon Steve Kemp at 08:01 on 17 April 2013

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