Pisg

From DreamHost
Jump to: navigation, search

Pisq is a Pearl based IRC Statistics generator that allows you to create an index.html file in a directory of your choosing. Dreamhost does not allow you to run an IRC Bot on their servers. However you can retrieve logs from anywhere so long as it is accessible from the web. So you could run your own home server or you can use the services of a friend who can be on your IRC channel at all times and have them place logs online.


Running Pisg

First you will need to download Pisg from here and then extract it on your Desktop into a folder called "pisg" and then put it in your home directory.

Script

This script is under the impression that you are going to have a .log file that is split into dates and that it will run after 12AMPDST

Copy and then paste this into a document called run.sh and put it in your home directory

#!/bin/bash

##Username
username="yourusername"
##website directory
webd="yourwebsite.com"


##Display what is gong on
echo Moving index.html to index$(date +%Y%m%d -d yesterday).html

##Display Command
echo cp /home/$username/$webd/path/to/your/old/index.html /home/$username/$webd/path/to/your/archives/index$(date +%Y%m%d -d yesterday).html

##Move old index file into archives
cp /home/$username/$webd/path/to/your/old/index.html /home/$username/$webd/path/to/your/archives/index$(date +%Y%m%d -d yesterday).html


##Display what is going on
echo Grabbing logfile$(date +%Y%m%d -d yesterday).log

##Display Command
echo /usr/bin/wget furlforyourlog$(date +%Y%m%d -d yesterday).log

##Get Log file for the day before
/usr/bin/wget furlforyourlog$(date +%Y%m%d -d yesterday).log


##Display what is going on
echo Copying logfile$(date +%Y%m%d -d yesterday).log to larger log


##Display Command
echo cat /home/$username/logfilesmall$(date +%Y%m%d -d yesterday).log >> /home/$username/path/to/larger/logfile.log


##Place contents of the small log file onto the bottom of the larger log file
cat /home/$username/logfilesmall$(date +%Y%m%d -d yesterday).log >> /home/$username/path/to/larger/logfile.log

##Display what is going on
echo Running Pisg

##Display Command
echo /usr/bin/perl /home/$username/pisg/pisg


##Run Pisg
/usr/bin/perl /home/$username/pisg/pisg


##Display what is gong on
echo Cleaning up

##Display Command
echo rm /home/$username/yourlogfile$(date +%Y%m%d -d yesterday).log

##Clean up
rm /home/$username/yourlogfile$(date +%Y%m%d -d yesterday).log


##Display Success
echo ****Success!***


Running the Script

You will need to change a few lines to reflect where you are getting your logs and where you are planning to display your stats and after that shh into your account and run "crontab -e" and then put

0 1 * * * sh /home/yourusername/run.sh
Personal tools