Sep 05 2008

Add table constraint: UNIQUE

Tag: MySqlberrisch @ 11:38 am

To add a unique contraint for two table fileds, simply execute the following command:

ALTER TABLE scene_commands ADD UNIQUE (scene_id, command_id);

Sep 01 2008

Faillog: Reset authentication failures on Unix / Linux

Tag: Unixberrisch @ 5:51 pm

Testing a lot on your servers can sometimes lead to the problem, that you receive this error message:
‘Received disconnect from Too many authentication failures for root’
or of course for other users, try faillog!

There are some options to view / reset the authentication failures for the given user(s)


This is the man page of this very useful command:

faillog --help
Syntaxe : faillog [options]
 
Options :
  -a, --all          afficher les enregistrements « faillog » pour tous
                       les utilisateurs
  -h, --help           afficher ce message d'aide et quitter
  -l, --lock-time SEC  après une connexion refusée, verrouiller le compte
                       pendant SEC secondes
  -m, --maximum MAX    positionner les compteurs de connexions refusées à
                       MAX
  -r, --reset          remettre à zéro les compteurs de connexions refusées
  -t, --time NB_JOURS  afficher les échecs de connexions datant de moins de
                       NB_JOURS jours
  -u, --user LOGIN     afficher l'enregistrement « faillog » ou gérer les
                       compteurs et les limites (si utilisé conjointement aux
                       options -r, -m ou -l) d'échecs uniquement pour
                       l'utilisateur dont le compte est LOGIN

Aug 05 2008

stdout, stdin

Tag: Perlberrisch @ 3:45 pm


Howto redirect the standard input and output of a command shell script:

STDERR and STDOUT together:

    $output = `cmd 2>&1`;

To capture a command’s STDOUT but discard its STDERR:

    $output = `cmd 2>/dev/null`;

To capture a command’s STDERR but discard its STDOUT (ordering is important here):

    $output = `cmd 2>&1 1>/dev/null`;

To exchange a command’s STDOUT and STDERR in order to capture the STDERR but leave its STDOUT to come out the old STDERR:

    $output = `cmd 3>&1 1>&2 2>&3 3>&-`;

To read both a command’s STDOUT and its STDERR separately, it’s easiest to redirect them separately to files, and then read from those files when the program is done:

    system("program args 1>program.stdout 2>program.stderr");

Next Page »