Generating random salts from bash
From the ‘just because it can be done’ column, here comes a handy shell script to generate random salts.
So, without further ado, here it goes:
#!/bin/bash
[ $# -eq 0 ] && {
echo “usage: salt <length>”>&2
exit
}
strings </dev/urandom | while read [...]
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
[...]
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, here’s [...]
