By fernando | January 13, 2009

Top 25 most dangerous programming errors

Most people make at least 8 or 9 of these in a new project, and this alone is a good reason to use a programming framework, unless you know what you’re doing. The problem is, sometimes, people who skip on frameworks, don’t know what they’re doing. Or, as the Tao of Programming says: There once [...]

By fernando | January 12, 2009

Running commands from the shell with a timeout (pt 2)

Here’s an improved version of the safecmd script. This one doesn’t always wait for $timeout seconds even if the command you’re running exits successfully. In that case, it kills the monitor script and ends at the proper time. Here’s the code: #!/bin/bash timeout=$1 command=$2 shift 2 check_pid_name() { command=$1 childpid=$2 [ -d /proc/$childpid ] || [...]

By fernando | January 10, 2009

Running commands from the shell with a timeout

Sometimes, in a shell script, you need to run a command that might go on forever (or an amount of time long enough to be called forever) due to poor coding of the software and wrong external conditions (network down or overloaded, overloaded system, a changed private key, etc). In order to avoid this situations, [...]