SQLITE | BASH | handle ‘database locked’

function do_sql { DB=”$1″ shift test -r “$DBDIR/$DB” if [ $? -ne 0 ]; then write2log “Creating DB $DB” create_db “$DB” fi if [ “x$@” == “x” ]; then return 1; fi LOOP=1;MAXLOOP=10 while true;do $SQLITE “$DBDIR/$DB” “$@” 2>/dev/null && return 0 LOOP=$(( $LOOP + 1 )) RD=”0.$(( ( RANDOM % 9 ) + 1 […]

OpenBSD | Editing the /etc/passwd file

Always use vipw, it updates the passwd database /etc/spwd.db This database is used by the running system. Any changes of /etc/passwd, dome with simple editors will be overwritten next time you will use useradd, userdel etc.