Tag Archives: CRON

Perl email SMS alert

Before getting a new smartphone, I had a razor phone, which could get SMS messages, but not web. This script checks an email account via POP3, and checks the most recent 10 messages. These messages are compared to the messages noted in the MySQL database, if there are any new messages, a small notification is emailed to my phone using an “SMS gateway”, which is an email address such as: 8005551212@tmomail.net. Most cell carriers have some sort of gateway address for forwarding from email to SMS.

Upon a new email, I would be presented with a text telling me which account to check who it’s from, and the subject. It was run from CRON every 10 minutes, like so:

./checkem.pl address@toCheck.com myEmailPassword pop.gmail.com 9255551212@tmomail.net
Read more »

MySQL auto-Tweet

While running thebandmind.com, I thought it would be fun to have a Twitter account which automatically is updated twice a day with a random quote from the database of quotes. This Perl script is run from Cron.

MySQL Database:

CREATE TABLE IF NOT EXISTS `quotes` (
  `ID` int(10) unsigned NOT NULL auto_increment,
  `stamp` timestamp NOT NULL default CURRENT_TIMESTAMP 
    on update CURRENT_TIMESTAMP,
  `twitter` varchar(140) default NULL,
  `tweets` int(5) NOT NULL default '0',
  PRIMARY KEY  (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

Read more »

Perl – SysGuard

I had a problem with web crackers changing some of my pages, adding some nasty JavaScript at the bottom. This script I wrote checks a database defined list of directories and files for various types of change. It can detect changes like file size, inode change, owner, group owner, permissions, etc. If the scan is running on a directory, it detects for any missing / added files. It is to be run from the bash shell, or from CRON.

Running it with result in this help screen:

SysGuard - Bray Almini 2009-06-28.
Keeps an eye on files and folders, detecting new files and changes.

usage: ./sysguard.pl [funtion] [file path]

        Functions:
        --scan  Check all files and folders in DB for changes
        --update        Update data on old record, or create a new record
        --list  Display all files and folders being watched
        --clear Delete a record from the DB

Read more »

HateBotX


Hatebotx is an aol instant messaging bot (aim-bot). It uses flatfiled volcabulary lists to attempt to find suitable replys to text recieved. All conversations are logged into yet more flatfiles. It’s a big ugly mess, but it worked well at the time.There had been similar bots on AIM such as SmarterChild, who were helpful and polite; but they were not HateBotX. This bot did not utilize the Elisa engine, and had very little intelligence. However, it would still get a lot of laughs despite it’s simplicity.

Read more »