Sigx

We are the future in the past.
It is currently Wed Nov 22, 2017 12:54 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: Sun May 02, 2004 12:56 pm 
Offline

Joined: Thu Apr 01, 2004 2:13 pm
Posts: 5
There isn't a fixed directory, it could go almost anywhere, but I'd just put it somewhere in your home folder. You could just use ~/, but something like ~/scripts or ~/cronjobs might be better if you don't want to mess up your directory.

(~ is UNIX shorthand for your home folder, ie: /home/username on most systems, or /Users/shortusername on Mac OS X. I'm not sure if it works with cron, it'd be safer to put the full path into your crontab)

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 09, 2004 9:29 pm 
Offline

Joined: Sat Jan 17, 2004 3:13 pm
Posts: 181
...

_________________
]Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 24, 2004 6:09 pm 
Offline

Joined: Mon May 24, 2004 5:53 pm
Posts: 1
Location: a dark place.
oh and you music people out there.. here's a way to set up your script with xmms song info:

download and compile the xmms-infopipe plugin.

then put this into the script:

Code:
$XMMS = `cat /tmp/xmms-info | grep "Title: " | sed "s/Title: //"`;
chop ($XMMS);


then tack this on after the bogomips part on the line starting with
$DATA_2_SEND=

Code:
Current Song: $XMMS*<*


and for you lazy folk, here's my modded script:


Code:
#!/usr/bin/perl

# Credits     : This script was created by and is currently maintained
#               by Victor Igumnov [[email protected]].
#
# Legal Info  : Copyright (C) 2003, Victor Igumnov [[email protected]]
#
#               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';

#Edit this to your distro's name.
$DISTRO="I'm a damn lamer who cant read.";
#edit this for your default X11 address
#(usually just :0)
$DISPLAY=":0";
##########

$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 = `/usr/X11R6/bin/xdpyinfo -display $DISPLAY | 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);

$XMMS = `cat /tmp/xmms-info | grep "Title: " | sed "s/Title: //"`;
chop ($XMMS);

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: $DISTRO $UNAME *<*System Uptime: $UPTIME *<*Current Resolution: $RES *<*$MEMPERCENT% Ram Used | Total RAM = $MEMTOTAL MB | Available RAM = $RAMLEFT MB*<*CPU: $CPUNAME @ $CPUSPEED MHz, $BOGOMIPS BOGOMIPS*<*Current Song: $XMMS*<*";
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;

_________________
Image
www.acidchat.net Acidchat IRC network.
irc.acidchat.net 6667


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 06, 2004 10:30 am 
Offline

Joined: Sun Jun 06, 2004 10:30 am
Posts: 1
First post ..
Code:
Bareword found where operator expected at ./sigxv1.pl line 88, near "$DATA_2_SEND .= "Diskspace"
  (Might be a runaway multi-line "" string starting on line 87)
        (Missing operator before Diskspace?)
Bareword found where operator expected at ./sigxv1.pl line 88, near "$HDD Free"
        (Missing operator before Free?)
String found where operator expected at ./sigxv1.pl line 89, near "# $DATA_2_SEND .= ""
  (Might be a runaway multi-line "" string starting on line 88)
        (Missing semicolon on previous line?)
Bareword found where operator expected at ./sigxv1.pl line 89, near "# $DATA_2_SEND .= "Screen"
        (Missing operator before Screen?)
String found where operator expected at ./sigxv1.pl line 104, near "my $curl = url(""
  (Might be a runaway multi-line "" string starting on line 89)
        (Missing semicolon on previous line?)
Bareword found where operator expected at ./sigxv1.pl line 104, near "my $curl = url("http"
        (Do you need to predeclare my?)
syntax error at ./sigxv1.pl line 88, near "$DATA_2_SEND .= "Diskspace"
Can't find string terminator '"' anywhere before EOF at ./sigxv1.pl line 104.


Any ideas?

Running Gentoo similar to this thread ..
http://forum.yuriy.net/phpbb/viewtopic. ... eword#2013


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 17, 2004 3:59 pm 
Offline

Joined: Thu Jun 17, 2004 3:56 pm
Posts: 1
Location: Dallas, TX
Thanks for the help guys. Alas, I am a relitave xnix noob. I needed your help for the cronjob.

I am working on adding my seti count as well, but I am dabbling in things I don't completely understand.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 17, 2004 4:30 pm 
Offline

Joined: Mon Mar 15, 2004 1:48 pm
Posts: 1395
Location: Los Angeles
learn by trial and error. and dont forget to RTFM

_________________
Image

Image

Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 17, 2004 4:49 pm 
Offline

Joined: Mon Apr 05, 2004 8:37 pm
Posts: 335
Location: /home/chair/sitting down/
the seti thing already has a signature thing.... you should check at berkeley.edu (i always mis-spell that url) for setisig... then incorporate code into the php files


at least i think they had it

_________________
Image
My Site: www.dh5.us
I'll kill you Brian Anderson


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 23, 2004 11:00 am 
Offline

Joined: Wed Jun 23, 2004 10:50 am
Posts: 2
This work for me for real temps in sig.

Code:
$CPU=`sensors | grep CPU |cut -f 2 |cut -d + -f 2|cut -d '(' -f 1`;
$MOBO=`sensors | grep M/B |cut -f 2 |cut -d + -f 2|cut -d '(' -f 1`;
chop($MOBO);
chop($CPU);
$DATA_2_SEND .= "CPU Temp: $CPU | M/B Temp: $MOBO *<*";

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2004 4:36 pm 
Offline

Joined: Wed Jun 23, 2004 10:50 am
Posts: 2
made some changes instead of using xmmsinfo it uses mb and cpu temps with F or C in the temps and instead of resolution have diskinfo and ignores nfs partitions as it was making diskinfo reporting same space twice if you have a nfs partition mounted.
Code:
!/usr/bin/perl

# Credits     : This script was created by and is currently maintained
#               by Victor Igumnov [[email protected]].
#
# Legal Info  : Copyright (C) 2003, Victor Igumnov [[email protected]]
#
#               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 sensor labels
$CPULABEL='CPU';
$MBLABEL='M/B';
$CPU=`sensors | grep $CPULABEL |awk '{print \$2 \$3}'`;
chop($CPU);
$MOBO=`sensors | grep $MBLABEL |awk '{print \$2 \$3}'`;
chop($MOBO);
my $FAN='fan2';

#Edit this to your distro's name.
$DISTRO="Gentoo";
#edit this for your default X11 address
#(usually just :0)
$DISPLAY=":0";
##########

$CPUNAME=`cat /proc/cpuinfo | grep '^model name' | head -n 1 | sed -e 's/^.*: //'`;
$CPUSPEED=`cat /proc/cpuinfo | grep 'cpu MHz' | head -n 1 | sed -e 's/^.*: //'`;
$BOGOMIPS=`cat /proc/cpuinfo  | grep 'bogomips' |  head -n 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 = `/usr/X11R6/bin/xdpyinfo -display $DISPLAY | grep dimensions | awk '{print \$2}'`;
chop ($RES);

#--DISKSPACE--#
$HDD = `df -x nfs | awk '{ sum+=\$2/1024^2 }; END { printf (\"%dGb\", sum )}'`;
chop ($HDD);

#--DISKSPACE FREE--#
$HDDFREE = `df -x nfs | awk '{ sum+=\$4/1024^2 }; END { printf (\"%dGb\", sum )}'`;
chop ($HDDFREE);

#--SCREEN RESOLUTION--#
$RES = `xdpyinfo | grep dimensions | awk '{print \$2}'`;
chop ($RES);

#$XMMS = `cat /tmp/xmms-info | grep "Title: " | sed "s/Title: //"`;
#chop ($XMMS);

chop($UNAME);
chop($CPUNAME);
chop($CPUSPEED);
chop($BOGOMIPS);
$RAMLEFT=$MEMTOTAL-$MEMFREE;

$query = new CGI;
$query->import_names('webform');

my $username = "xxxx";
my $password = "xxxx";
$DATA_2_SEND="OS: $DISTRO $UNAME *<*System Uptime: $UPTIME *<*Diskspace: $HDD Free: $HDDFREE*<*$MEMPERCENT% Ram Used | Total RAM = $MEMTOTAL MB | Available RAM = $RAMLEFT MB*<*CPU: $CPUNAME @ $CPUSPEED MHz, $BOGOMIPS BOGOMIPS*<*CPU Temp: $CPU M/B Temp: $MOBO";
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;

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 02, 2004 11:50 am 
Offline

Joined: Mon Aug 02, 2004 11:42 am
Posts: 4
I'm running Mac OX X Panther and I can't seem to get the script to run.. I get this error when running it through the terminal or web browser...

When running sigx.pl i get:

[jpowermac-g4s-Computer:~] powermac% perl /WebSTAR\ Server\ Suite\ 4.3/cgi-bin/sigx.pl
cat: /proc/cpuinfo: No such file or directory
cat: /proc/cpuinfo: No such file or directory
cat: /proc/cpuinfo: No such file or directory
sh: line 1: free: command not found
sh: line 1: free: command not found
sh: line 1: free: command not found
sh: line 1: xdpyinfo: command not found
sh: line 1: xdpyinfo: command not found
[jpowermac-g4s-Computer:~] powermac%


and with sigxv1.pl:

[jpowermac-g4s-Computer:~] powermac% perl /WebSTAR\ Server\ Suite\ 4.3/poiu/cgi-bin/sigxv1.pl
Bareword found where operator expected at /WebSTAR Server Suite 4.3/poiu/cgi-bin/sigxv1.pl line 88, near "$DATA_2_SEND .= "Diskspace"
(Might be a runaway multi-line "" string starting on line 87)
(Missing operator before Diskspace?)
Bareword found where operator expected at /WebSTAR Server Suite 4.3/poiu/cgi-bin/sigxv1.pl line 88, near "$HDD Free"
(Missing operator before Free?)
syntax error at /WebSTAR Server Suite 4.3/poiu/cgi-bin/sigxv1.pl line 88, near "$DATA_2_SEND .= "Diskspace"
Unterminated <> operator at /WebSTAR Server Suite 4.3/poiu/cgi-bin/sigxv1.pl line 88.
[jpowermac-g4s-Computer:~] powermac%


I dunno much about perl I was trying to fix line 88.. I deleted the extra | $ but that doesn't seem to help.

Code:
81 my $username = "a";
82 my $password = "a";
83 $DATA_2_SEND="Uptime: $MYUPTIME *<*";
84 $DATA_2_SEND .= "CPU: $CPUNAME *<*";
85 $DATA_2_SEND .= "MHZ: $CPUSPEED *<*";
86 # $DATA_2_SEND .= "BOGOMIPS: $BOGOMIPS *<*";
87 $DATA_2_SEND .= "OS: $UNAME *<*$MEMPERCENT% Ram Used | Total RAM = $MEMTOTAL";
88 $DATA_2_SEND .= "Diskspace: $HDD Free: $HDDFREE *<*";
89 # $DATA_2_SEND .= "Screen Res: $RES";
90 #print $DATA_2_SEND;


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 03, 2004 12:39 am 
Offline

Joined: Thu Apr 01, 2004 2:13 pm
Posts: 5
The Linux code doesn't work very well with Mac OS X, as they're quite different Unixes. You'll have more luck with BSD specific scripts, but I did do a Mac OS X one that's further up in the post, complete with vague unreliable installation instructions. But here's an uploaded version of my version. It sill needs a dozen bits and bobs to be installed before it works though, and probably some hand hacking to get it to look the way you want.

Mac OS X / iTunes SigX script

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 03, 2004 12:07 pm 
Offline

Joined: Mon Mar 15, 2004 1:48 pm
Posts: 1395
Location: Los Angeles
if you cant get perl to work on mac osx and havent tried the macOS client, heres the link:

http://forum.yuriy.net/phpbb/viewtopic.php?t=814

_________________
Image

Image

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 07, 2004 5:46 pm 
Offline

Joined: Sat Aug 07, 2004 5:43 pm
Posts: 1
I just wanna say that I got it working on Fedora Core 2 (The modified one with xmms, THanks for that) with no real problems at all, just the screen res wouldn't work because I use xorg not xfree, to lazy to make the adjustment and commentted it out. I will in a few days.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 02, 2004 7:50 pm 
Offline

Joined: Wed Apr 07, 2004 10:12 am
Posts: 15
Location: Setting fire to all things evil. Like Bill Gates' pants.
I got really annoyed that when I wasn't listening to music, /tmp/xmms-info hadn't been created. I would get mail in /var/spool, and it really got annoying after a while, so I modified the XMMS script a bit.

instead of having the regular one, use this instead.

Code:
$XMMS = `if [ -e /tmp/xmms-info ]
  then
    cat /tmp/xmms-info | grep "Title: " | sed "s/Title: //"
  else
    echo "I'm not listening to anything"
fi `;


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 13, 2004 7:11 pm 
Offline

Joined: Mon Sep 13, 2004 6:44 pm
Posts: 1
There is a perl module called Xmms::Remote which can be used to get info from xmms, heres some code i've used:

Code:
#!/usr/bin/perl
use Xmms::Remote ();

$xmms_remote = Xmms::Remote->new();

if($xmms_remote->get_playlist_length() == 0)
{
        print "Nothing playing!\n";
        exit;
}

my $track = $xmms_remote->get_playlist_pos;
my($rate, $freq, $nch) = $xmms_remote->get_info;
if($nch == 2)
{
        $nchstr = "stereo";
}
else
{
        $nchstr = "mono";
}
print "(music) ".($track+1).". ".$xmms_remote->get_playlist_title($track)." [".$xmms_remote->get_output_timestr."] [".($rate/1000)."kbits] [".($freq/1000)."kHz] [$nchstr]";


heres the cpan page for the module:
http://search.cpan.org/~dougm/Xmms-Perl ... /Remote.pm

and some sample output:

Code:
(music) 83. Muse - House Of The Rising Sun [1:16/4:29 (28%)] [128kbits] [44.1kHz] [stereo]


If you want foldingathome current work unit info:

Code:
#change to path to your unitinfo.txt
$unitinfo = "/opt/foldingathome/unitinfo.txt";

$protein =  `grep Name $unitinfo | awk '{ print \$2 }'`;
$progress = `grep Progress $unitinfo | awk '{ print \$2  \" \"\$3 }'`;
$protein  =~s/(\n|\r)//g;
$progress  =~s/(\n|\r)//g;

print "F\@H: $protein $progress\n";


Sample output:
Code:
[email protected]: p638_L939_K12M_ext 0% [__________]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group