#!/bin/bash
gmail_login="********"
gmail_password="********"
mails="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom \
--no-check-certificate | grep 'fullcount' \
| sed -e 's/.*
if [ "$mails" -gt "0" ];
then
for ((i = 0; i < 10; i++)) do
/tmp/lpt/lpt_advance 1;
sleep 0.8;
/tmp/lpt/lpt_advance 0;
sleep 0.5;
done
/tmp/lpt/lpt_advance 1
else
/tmp/lpt/lpt_advance 0
fi
exit
##################
Where /tmp/lpt/lpt_advance is binary compiled from source:
cat lpt_advance.c
/*
* * Simple parallel port output control program for Linux
* * Written and copyright by Tomi Engdahl 1998
* * (e-mail: tomi.engdahl@hut.fi)
* *
* * The program output the data value to PC parallel port data pins
* * (default lpt1 I/O address 0x378). The data values are given as the
* * command line parameter to the program. The number can be
* * in decimal (0..255) or hexadecimal format (0x00..0xFF).
* *
* */
#include
#include
#include
#include
#define base 0x378 /* printer port base address */
main(int argc, char **argv)
{
int value;
if (argc!=2)
fprintf(stderr, "Error: Wrong number of arguments. This program needs one argument which is number between 0 and 255.For example running ./lptout 0xFF will turn all data pins to 1 and running ./lptout 0x00 will turn all data pins to 0.\n"), exit(1);
if (sscanf(argv[1],"%i",&value)!=1)
fprintf(stderr, "Error: Parameter is not a number.\n"), exit(1);
if ((value<0)>255))
fprintf(stderr, "Error: Invalid numeric value. The parameter number must be between 0 and 255\n"), exit(1);
if (ioperm(base,1,1))
fprintf(stderr, "Error: Couldn't get the port at %x\n", base), exit(1);
outb((unsigned char)value, base);
}