Earlier in this thread, someone posted how to add a cronjob:
Quote:
oh for linux nubs who don't know how to crontab what i do is add a line to a file like cronjob.conf.. following line is for sigx..
Code:
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /dir/to/sigx.pl >/dev/null 2>&1
will run every 2 minutes
then exit and type: crontab cronjob.conf
it'll replace any other cronjobs you have, thats why i just keep one file for cronjobs at user level.
I personally used Webmin to set it up, and just pointed it to the sigx.pl file. I also had to chmod the file to make it executable. You can test it before adding it as a cronjob, by just typing ./sigx.pl in the folder containing the file. I've since tweaked it a little bit since I submitted it to the forum, but the latest version is here:
Code:
#!/usr/bin/perl
# Credits : This script was created by and is currently maintained
# by Victor Igumnov [lamer0@lamer0.com].
#
# Legal Info : Copyright (C) 2003, Victor Igumnov [lamer0@lamer0.com]
#
# This program is free software. You may redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software
# Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
$|=1;
use CGI;
use URI::URL;
use LWP::UserAgent;
#Set These
my $CPU='temp3';
my $MOBO='temp2';
my $FAN='fan2';
$CPUNAME=`cat /proc/cpuinfo | grep '^model name' | head -1 | sed -e 's/^.*: //'`;
$CPUSPEED=`cat /proc/cpuinfo | grep 'cpu MHz' | head -1 | sed -e 's/^.*: //'`;
$BOGOMIPS=`cat /proc/cpuinfo | grep 'bogomips' | head -1 | sed -e 's/^.*: //'`;
$UNAME = `uname -sr`;
#--PERCENTAGE OF MEMORY FREE--#
$MEMPERCENT = `free | grep Mem | awk '{print (( \$3 -(\$6 + \$7) )/\$2)*100}'`;
chop ($MEMPERCENT);
$MEMPERCENT = sprintf('%.2f', $MEMPERCENT);
#--UPTIME--#
$UPTIMEDAYS = `uptime | awk '{printf (\$3)}'`;
$UPTIMEHOURS = `uptime | awk '{printf(\$5)}' | awk -F ':' '{printf(\$1)}'`;
$UPTIMEMINS = `uptime | awk '{printf(\$5)}' | awk -F ':' '{printf(\$2)}' | head -c 2`;
$UPTIME = "$UPTIMEDAYS Days $UPTIMEHOURS Hours $UPTIMEMINS Mins";
#--MEMORY FREE--#
$MEMFREE = `free | grep Mem | awk '{printf (\"%.0f\", ( \$3 -(\$6 + \$7) )/1000)}'`;
#chop ($MEMFREE);
#--TOTAL MEMORY--#
$MEMTOTAL = `free | grep Mem | awk '{printf (\"%d\", \$2/1000 )}'`;
#chop ($MEMTOTAL);
#--SCREEN RESOLUTION--#
$RES = `xdpyinfo | grep dimensions | awk '{print \$2}'`;
chop ($RES);
#--DISKSPACE--#
$HDD = `df | awk '{ sum+=\$2/1024^2 }; END { printf (\"%dGb\", sum )}'`;
chop ($HDD);
#--DISKSPACE FREE--#
$HDDFREE = `df | awk '{ sum+=\$4/1024^2 }; END { printf (\"%dGb\", sum )}'`;
chop ($HDDFREE);
#--SCREEN RESOLUTION--#
$RES = `xdpyinfo | grep dimensions | awk '{print \$2}'`;
chop ($RES);
chop($UNAME);
chop($CPUNAME);
chop($CPUSPEED);
chop($BOGOMIPS);
$RAMLEFT=$MEMTOTAL-$MEMFREE;
$query = new CGI;
$query->import_names('webform');
my $username = "a";
my $password = "a";
$DATA_2_SEND="OS: Debian $UNAME *<*System Uptime: $UPTIME *<*$MEMPERCENT% Ram Used | Total RAM = $MEMTOTAL MB | Available RAM = $RAMLEFT MB*<*CPU: $CPUNAME @ $CPUSPEED MHz, $BOGOMIPS BOGOMIPS*<*";
printf $MEMTOTAL;
print $DATA_2_SEND;
my %form = ();
%form =('username' => $username,
'password' => $password,
'data' => $DATA_2_SEND,
'Submit' => '');
my $ua = new LWP::UserAgent;
my $curl = url("http:");
my $req = new HTTP::Request 'POST','http://sigx.yuriy.net/update.php';
$req->content_type('application/x-www-form-urlencoded');
$req->content($curl->equery);
$curl->query_form(%form);
$req->content($curl->equery);
my $response= $ua->request($req)->as_string;
Hope this helps!
(Dont forget to install the libraries mentioned at the beginning of the thread)