msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

08 Sep 2007 Find domain expiration date

To get expiration date use grep command:

$ whois nixcraft.com | egrep -i 'Expiration|Expires on'
Output:

 Expiration Date: 10-may-2009
NOTICE: The expiration date displayed in this record is the date the
currently set to expire. This date does not necessarily reflect the expiration
view the registrar's reported date of expiration for this registration.
      Expires on: 10-May-09

Here is my script:

#!/bin/bash
# Domain name list - add your domainname here
DOM="theos.in cricketnow.in nixcraft.com nixcraft.org nixcraft.biz nixcraft.net nixcraft.info cyberciti.biz cyberciti.org gite.in nixcraft.in"
for d in $DOM
do
  echo -n "$d - "
  whois $d | egrep -i 'Expiration|Expires on' | head -1
  # If you need list..
  # whois $d | egrep -i 'Expiration|Expires on' | head -1 >> /tmp/domain.date
  #
  echo ""
done
#
# [ -f /tmp/domain.date ] && mail -s 'Domain renew / expiration date' you@yahoo.com < /tmp/domain.date || :
#

Output:

theos.in - Expiration Date:28-Oct-2007 13:01:58 UTC

cricketnow.in - Expiration Date:29-Jul-2008 09:17:56 UTC

nixcraft.com -    Expiration Date: 10-may-2009

nixcraft.org - Expiration Date:13-Aug-2007 14:58:30 UTC

nixcraft.biz - Domain Expiration Date:                      Fri Jun 01 23:59:59 GMT 2007

nixcraft.net -    Expiration Date: 11-dec-2007

nixcraft.info - Expiration Date:26-Jun-2007 11:05:13 UTC

cyberciti.biz - Domain Expiration Date:                      Tue Jun 30 23:59:59 GMT 2009

cyberciti.org - Expiration Date:25-May-2007 11:20:40 UTC

gite.in - Expiration Date:14-Sep-2007 06:47:36 UTC

nixcraft.in - Expiration Date:02-Feb-2008 05:33:08 UTC

Tags: , ,

Posted by

30 Jul 2007 Look for obvious signs of trouble in Postfix

Postfix logs all failed and successful deliveries to a logfile. The file is usually called /var/log/maillog or /var/log/mail; the exact pathname is defined in the /etc/syslog.conf file.

(more…)

Tags: , ,

Posted by

15 May 2007 Shell scripts for archiving digital photos in directories by month

This is my version of the shell script “Shell scripts for archiving digital photos in directories by date“. It utilizes  the exiftags command available in most linux distributions like Gentoo and debian Linux. Though the metacam program is also usefull since it can read Nikon NEF-files.Here’s an example of a directory tree they create:

2006  2006-10       IMG_48324.JPG       IMG_48325.JPG       IMG_48326.JPG       IMG_48331.JPG       IMG_48333.JPG       IMG_48334.JPG       IMG_48337.JPG  2006-11       IMG_48338.JPG  ...etc...

move-digiphotosThis bash script (move-digifotos) scans EXIF tags from .JPG files in current directory with metacam, creates necessary directories under $BASEDIR and moves the files in them:

#!/bin/bash# Reads EXIF creation date from all .JPG files in the# current directory and moves them carefully under##   $BASEDIR/YYYY/YYYY-MM/YYYY-MM-DD/## ...where 'carefully' means that it does not overwrite# differing files if they already exist and will not delete# the original file if copying fails for some reason.## It DOES overwrite identical files in the destination directory# with the ones in current, however.## This script was originally written and put into# Public Domain by Jarno Elonen ; in June 2003.# Feel free to do whatever you like with it.BASEDIR=/home/backup/testfind -maxdepth 1 -name "*.JPG" | while read x; doDATE=`exiftags "$x" | \   egrep "^[ t]*Image Created:" | \   sed -r "s/Image Created: ([0-9:]*).*/\1/"`if [ ! -z "$DATE" ];then    YEAR=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\1/"`    MONTH=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\2/"`    if [ "$YEAR" -gt 0 ] & [ "$MONTH" -gt 0 ]    then    INSTDIR=${BASEDIR}/${YEAR}/${YEAR}-${MONTH}    install -d "$INSTDIR"    INSTFILE="$INSTDIR/$x"    if [ -e "$INSTFILE" ] && ! cmp -s "$x" "$INSTFILE"    then        echo "WARNING: '$INSTFILE' exists already and is different from '$x'."    else        echo "Moving '$x'"        cp -ax "$x" "$INSTFILE"        if ! cmp -s "$x" "$INSTFILE"        then        echo "WARNING: copying failed somehow, will not delete original '$x'"        else        rm -f "$x"        fi    fi    else    echo "WARNING: '$x' doesn't contain date."    fielse    echo "WARNING: '$x' doesn't contain date."fidone

Tags: , , , , , , , , , ,

Posted by

15 May 2007 Shell scripts for archiving digital photos in directories by date

The fact that most digital cameras store the shooting dates inside JPEG files in the EXIF format makes it possible to automatically archive the photos by date right after they are downloaded, which is exactly what the scripts below do.

Here’s an example of a directory tree they create:

1999
  1999-07
     1999-07-14
       IMG_48324.JPG
       IMG_48325.JPG
       IMG_48326.JPG
     1999-07-17
       IMG_48331.JPG
       IMG_48333.JPG
       IMG_48334.JPG
       IMG_48337.JPG
  ...etc...

move-digiphotos
This bash script (move-digifotos) scans EXIF tags from .JPG files in current directory with metacam, creates necessary directories under $BASEDIR and moves the files in them:

#!/bin/bash

# Reads EXIF creation date from all .JPG files in the
# current direcotry and moves them carefully under
#
#   $BASEDIR/YYYY/YYYY-MM/YYYY-MM-DD/
#
# ...where 'carefully' means that it does not overwrite
# differing files if they already exist and will not delete
# the original file if copying fails for some reason.
#
# It DOES overwrite identical files in the destination directory
# with the ones in current, however.
#
# This script was originally written and put into
# Public Domain by Jarno Elonen  in June 2003.
# Feel free to do whatever you like with it.

  BASEDIR=/home/jarno/gfx

find -maxdepth 1 -name "*.JPG" | while read x; do
  DATE=`metacam "$x" | \
    egrep "^[ \t]*Image Capture Date:" | \
    sed -r "s/Image Capture Date: ([0-9:]*).*/\1/"`
  if [ ! -z "$DATE" ];
  then
    YEAR=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\1/"`
    MONTH=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\2/"`
    DAY=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\3/"`
    if [ "$YEAR" -gt 0 ] & [ "$MONTH" -gt 0 ] & [ "$DAY" -gt 0 ]
    then
      INSTDIR=${BASEDIR}/${YEAR}/${YEAR}-${MONTH}/${YEAR}-${MONTH}-${DAY}
      install -d "$INSTDIR"
      INSTFILE="$INSTDIR/$x"
      if [ -e "$INSTFILE" ] && ! cmp -s "$x" "$INSTFILE"
      then
        echo "WARNING: '$INSTFILE' exists already and is different from '$x'."
      else
        echo "Moving '$x'"
        cp "$x" "$INSTFILE"
        if ! cmp -s "$x" "$INSTFILE"
        then
          echo "WARNING: copying failed somehow, will not delete original '$x'"
        else
          rm -f "$x"
        fi
      fi
    else
      echo "WARNING: '$x' doesn't contain date."
    fi
  else
    echo "WARNING: '$x' doesn't contain date."
  fi
done

fetch-digiphotos
The fetch-digiphotos script fetches pictures from a camera through gphoto2 into a temporary directory under $TMPDIR, moves them with move-digiphotos and finally offers to delete them from the camera:

#!/bin/bash

# Downloads pictures from a digital camera using gphoto2,
# moves them with move-digiphotos.sh and optionally deletes
# them from the camera's memory.
#
# This script was originally written and put into
# Public Domain by Jarno Elonen  in June 2003.
# Feel free to do whatever you like with it.

TMPDIR=/home/jarno/gfx/tmp

if [ ! -d "$TMPDIR" ]; then
echo "*** Error: download directory '$TMPDIR' does not exist, aborting."
exit 1
fi
pushd "$TMPDIR" > /dev/null

gphoto2 -P
if [ $? != 0 ]; then
echo "*** error executing gphoto2, aborting."
popd > /dev/null
exit 1
fi

move-digiphotos

echo
echo -n "Delete pictures from camera? [y/N] "
read x
if [ $x == "y" ]; then
gphoto2 -D
fi
if [ $? != 0 ]; then
echo "Warning: error executing gphoto2."
popd > /dev/null
exit 1
fi

echo "Done."
popd > /dev/null

Kilde: Jarno Elonen, 2003-06-17

Tags: , , , , , ,

Posted by

01 Feb 2007 Utskrift av port, pid og daemon navn v.h.a netstat

netstat -nap| egrep "(0.0.0.0).*(0.0.0.0).*LISTEN" | gawk '{print $4 ":" $7}' | egrep -o ":(.*)" | cut -c 2-|sed 's/\//\:/'

Tags: , , ,

Posted by