A mixed week with minor tweaks

Saturday, 13 April 2013

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


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

[author] Steve Kemp

Submitted at 18:53:11 on 13 april 2013

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!

[gravitar] Jim

Submitted at 18:15:43 on 13 april 2013

I make my crontab entries look like:

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

Submitted at 23:31:20 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).

[gravitar] foo

Submitted at 01:42:02 on 14 april 2013

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

[author] Steve Kemp

Submitted at 09:28:05 on 14 april 2013

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

(Sponsorship could work, but ...)

[author] Steve Kemp

Submitted at 15:14:31 on 14 april 2013

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

[gravitar] foo

Submitted at 02:54:09 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.


[author] Steve Kemp

Submitted at 08:01:50 on 17 april 2013

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


Comments are closed on posts which are more than ten days old.

Recent Posts

Recent Tags