No such directory error calling lynx in a shell script

June 14th, 2010

Some time ago I was testing a shell script nagios plugin. Running this script from command line was ok, but once called from nagios scheduling, the plugin standard error was

/root/: No such directory

Due to some little problem (is this a lynx problem?)  I needed to set the HOME environment variable before calling lynx.

MYSTR=`export HOME=/tmp && /usr/bin/lynx -dump “http://$MYHOST/$MYURL?MYFILTER=$MYPARAM”`

turn off wordpress php error reporting

June 1st, 2010

If, due to your provider php configuration, Your wordpress pages are writing some error messages like

Deprecated: Assigning the return value of new by reference is deprecated in /home/j/jose/public_html/wp-settings.php on line 520
Deprecated: Assigning the return value of new by reference is deprecated in /home/j/jose/public_html/wp-settings.php on line 535
Deprecated: Assigning the return value of new by reference is deprecated in /home/j/jose/public_html/wp-settings.php on line 542
Deprecated: Assigning the return value of new by reference is deprecated in /home/j/jose/public_html/wp-settings.php on line 578
Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/j/jose/public_html/wp-settings.php on line 18

php warning message

In lost-in-code website You can find the solution: just add theese two lines

error_reporting(0);
@ini_set(‘display_errors’, 0);

at the bebinning og wp-config.php file.

playing with iSCSI

May 31st, 2010

Internet SCSI, shortly iSCSI, is an IP based protocol used for networking storage. With iSCSI it’s possible to send commands to remote SCSI storage on remote hosts, for this reason it is quite common in the SAN world.
Since IP networks are very common, iSCSI can be used to transmit data over LAN, WAN, or the Internet and can enable location-independent data storage and retrieval.

Once installed the package iscsitarget, You can specify the location of a shared area

vlinux19:/root# grep -v \# /etc/ietd.conf

Target iqn.2010-03.my.domain:my.storage.id
Lun 0 Path=/dev/sdc,Type=fileio
Alias Test

and, once started the daemon, any Windows client can see the storage with the Microsoft iSCSI initiator.iscsi client

NFS mount from an AIX client (reprise)

April 22nd, 2010

Today I needed to mount a linux nfs exported directory from a very old AIX server:

AIX prompt> uname -a
AIX matusalem 3 4 00202856E800

This time, I had to do an additional operation to my previous notes about nfs and AIX.
The mount command issued on the AIX matusalem client failed with the error

vmount: Not owner

and the linux server reported

Apr 22 12:21:03 linuxbox kernel: nfsd: request from insecure port (192.168.5.5:34506)!

in /var/log/messages file, where 192.168.5.5 is the old AIX IP address.
After adding the word “insecure” in the nfs option of my /etc/exports file in the linux server I was able to mount the nfs share.

/opt/share/dir 192.168.5.5(rw,sync,insecure)

a memory game

April 13th, 2010

Some day ago I wrote a simple javascript game. To play You have to find any couple of images by clicking on the images.
Please feel free to download and modify sources and images.

not – integer number comparison

March 8th, 2010

Some day ago I needed a shell script to compare some decimal values, but it’s not possible to compare as usual

MAX=33.33
if [ $MYVALUE -gt $MAX ]; then ….

Running something like this will bring the error message “integer expression expected!”.

With a little help from bc, it’s possible to compare non decimal values. Here follows a simple unuseful nagios plugin to compare decimal values:

#!/bin/bash

MYVALUE=$1
MAXWARN=”82.5″
MAXCRIT=”91.3″
MYDESCR=”Value description”
RET_OK=”0″
RET_WARN=”1″
RET_CRIT=”2″
RET_UNKN=”3″

PERFDATAMSG=”|’$MYDESCR’=$MYVALUE;$MAXWARN;$MAXCRIT”

if [ $(echo “$MYVALUE > $MAXCRIT”|bc) -gt 0 ]; then
echo “ERROR – $MYDESCR=$MYVALUE$PERFDATAMSG”
exit $RET_CRIT
fi

if [ $(echo “$MYVALUE > $MAXWARN”|bc) -gt 0 ]; then
echo “WARNING – $MYDESCR=$MYVALUE$PERFDATAMSG”
exit $RET_WARN
else
echo “OK – $MYDESCR=$MYVALUE$PERFDATAMSG”
exit $RET_OK
fi

batch ftp script

February 7th, 2010

If for some reason You need a quick and dirty script to retrieve some file from a ftp server, just open your text editor and write some things into your file. Then a simple command line command will download the file You have just write the path.

MS-DOS way:

C:\TMP> TYPE COMMANDFILE.TXT

username

password

dir

get wp-config.php

quit

C:\TMP> FTP -S:COMMANDFILE.TXT ftp.server.name

UNIX/LINUX way:

$ cat test

user username password

dir

get wp-config.php

quit

$ ftp -n ftp.server.name < test

encoding and decoding web content

January 16th, 2010

Today I played with Leet Key, a Firefox addon. This is an useful plugin for converting, encoding or decoding any text string taken from a web page with a simple right click.

To try this, just go to the addon download page, click the “add to firefox” button and then install the plugin.

Once rebooted your firefox browser, You can select and right click any text to convert it into several format.

leetkey usage

leetkey usage