Home grown mail scheduler with bash script and cron

If you are using Linux (Fedora/Ubuntu or anything else) then you do get a lot of tools and one of them is cron. Very very useful. Just write some script that can do the task for you, put it in cron and forget it. So, here is a home grown way to schedule mails.

First, copy this script below:

#!/bin/bash -
#===============================================================================
#
#          FILE: sched_mail.sh
#
#         USAGE: ./sched_mail.sh
#
#   DESCRIPTION:
#
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka), 
#      REVISION:  ---
#===============================================================================

mailfile="~/mail"
if [[ $(wc -l $mailfile|awk '{print $1}' ) -ge 5 ]]
then
    to=$(grep ^To: $mailfile|sed 's/To: //')
    echo "Good to send mail... to = $to"
    sendmail -t <$mailfile
    echo "once mail is send, delete the contents of file"
    echo "sed -i '4,$ d' $mailfile"
fi

Now, create a file called mail in your home directory, with the following contents:

To: Email
From: Email
Subject: Test mail from script.

Put the first script in cron to run every minute. And whenever you want to schedule a mail, create your mail in plaintext and then schedule that with at command to be appended to the ~/mail file. As soon as that file is appended, it will be sent out in 1 min 🙂

 

 

Enhanced by Zemanta

Introducing /run – what is this directory doing in my root directory?

boot process with EFI on Intel Macs
Image via Wikipedia

http://lwn.net/Articles/436012/

There is a suggestion to add /run directory that will be mounted as tmpfs. This directory will be mounted early in the boot process and can be used in various scenario’s. I hope this will improve few things in the linux world.

Enhanced by Zemanta

Create your own splash screen for gimp

\"Category:Created
Image via Wikipedia

Gimp allows you to set the splash screen very easily. All you need to do is copy the image to ~/.gimp-/splashes/. There is no limit on the size or color. You just copy all the images you like to have as splash and one of them would be randomly picked up from the said direcotory for the splash image.

Here is the snippet from the GIMP man page.

       GIMP comes with a default image for the splash screen but it allows system adminis-
       trators and users to customize the splash screen by  providing  other  images.  The
       image to be used with the splash screen is chosen as follows:


       1.     GIMP   tries   to   load   a   random   splash  screen  from  the  directory
              $HOME/.gimp-2.6/splashes.

       2.     It then falls back to using $HOME/.gimp-2.6/gimp-splash.png.

       3.     If the user didn\'t install any custom  splash  images,  a  random  image  is
              picked from /usr/share/gimp/2.0/splashes.

       4.     As   a   last  resort,  GIMP  uses  the  default  splash  image  located  at
              /usr/share/gimp/2.0/images/gimp-splash.png.
\"Reblog