Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Desktop Environments
  • Search

torsmo Tips & Tricks

Problems with GUI applications? Questions about X, KDE, Gnome, Fluxbox, etc.? Come on in. NOTE: For multimedia, go up one forum
Post Reply
Advanced search
223 posts
  • Page 1 of 9
    • Jump to page:
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 9
  • Next
Author
Message
Arainach
l33t
l33t
User avatar
Posts: 609
Joined: Thu Jul 08, 2004 2:30 am

torsmo Tips & Tricks

  • Quote

Post by Arainach » Mon Feb 07, 2005 9:21 pm

Sure, we've got a problems thread, but why not a tips and tricks thread? For posting useful ideas.

First, never underestimate the power of the execi command. I've used it for things like checking on Folding@Home unit Status, System Logs, etc. I've seen other people use it for things like monitoring weather. Incredibly powerful command.

Here's my current .torsmorc file - It's almost entirely borrowed from the Forums user who I give credit to at the top. I'm in the process of tweaking it to my liking, but when I first saw it I was like "This is what I've been trying to do for a few months", so when he posted his I decided to scrap my homemade .torsmorc and modify his (with credit, of course)

.torsmorc:

Code: Select all

# torsmo configuration
# Arainach's revisions, borrowed from Revisions by grad_guy from Gentoo Forums

# set to yes if you want tormo to be forked in the background
background no

# X font used, you can pick one with program xfontsel
#font 6x10
#font 7x13
#font 8x13
#font -*-clean-medium-r-*-*-12-*-*-*-*-*-*-*
#font -artwiz-kates-medium-*-*-*-14-*-*-*-*-*-*-*
#font -artwiz-kates-medium-*-normal-*-17-120-*-*-*-*-*-*
#font -*-webby caps-*-*-*-*-7-*-*-*-*-*-*-*
font -xos4-terminus-medium-r-normal--14-140-72-72-c-80-iso8859-1
#font -*-terminus-*-*-*-*-*-*-*-*-*-*-*-*
#font -*-bitstream vera sans mono-medium-r-*-*-12-*-*-*-*-*-*-*
# mail spool
mail_spool $MAIL

# Update interval in seconds
update_interval 3.0

# Create own window instead of using desktop (required in nautilus)
own_window no

# Minimum size of text area
minimum_size 80 5

# Draw shades?
draw_shades yes

# Draw outlines?
draw_outline no

# Draw borders naround text
draw_borders no

# Stippled borders?
stippled_borders 0

# border margins
border_margin 4

# border width
border_width 1

# Default colors and also border colors
#default_color spring green
default_color light blue
default_shade_color black
default_outline_color black

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
gap_x 10
gap_y 100

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# Possible variables to be used:
#
#      Variable         Arguments                  Description
#  acpiacadapter                     ACPI ac adapter state.
#  acpifan                           ACPI fan state
#  acpitemp                          ACPI temperature.
#  battery           (name)          Remaining capasity in ACPI or APM
#                                    battery. ACPI battery name can be
#                                    given as argument (default is BAT0).
#  buffers                           Amount of memory buffered
#  cached                            Amount of memory cached
#  color             (color)         Change drawing color to color
#  cpu                               CPU usage in percents
#  cpubar            (height)        Bar that shows CPU usage, height is
#                                    bar's height in pixels
#  downspeed         net             Download speed in kilobytes
#  downspeedf        net             Download speed in kilobytes with one
#                                    decimal
#  exec              shell command   Executes a shell command and displays
#                                    the output in torsmo. warning: this
#                                    takes a lot more resources than other
#                                    variables. I'd recommend coding wanted
#                                    behaviour in C and posting a patch :-).
#  execi             interval, shell Same as exec but with specific interval.
#                    command         Interval can't be less than
#                                    update_interval in configuration.
#  fs_bar            (height), (fs)  Bar that shows how much space is used on
#                                    a file system. height is the height in
#                                    pixels. fs is any file on that file
#                                    system.
#  fs_free           (fs)            Free space on a file system available
#                                    for users.
#  fs_free_perc      (fs)            Free percentage of space on a file
#                                    system available for users.
#  fs_size           (fs)            File system size
#  fs_used           (fs)            File system used space
#  hr                (height)        Horizontal line, height is the height in
#                                    pixels
#  i2c               (dev), type, n  I2C sensor from sysfs (Linux 2.6). dev
#                                    may be omitted if you have only one I2C
#                                    device. type is either in (or vol)
#                                    meaning voltage, fan meaning fan or temp
#                                    meaning temperature. n is number of the
#                                    sensor. See /sys/bus/i2c/devices/ on
#                                    your local computer.
#  kernel                            Kernel version
#  loadavg           (1), (2), (3)   System load average, 1 is for past 1
#                                    minute, 2 for past 5 minutes and 3 for
#                                    past 15 minutes.
#  machine                           Machine, i686 for example
#  mails                             Mail count in mail spool. You can use
#                                    program like fetchmail to get mails from
#                                    some server using your favourite
#                                    protocol. See also new_mails.
#  mem                               Amount of memory in use
#  membar            (height)        Bar that shows amount of memory in use
#  memmax                            Total amount of memory
#  memperc                           Percentage of memory in use
#  new_mails                         Unread mail count in mail spool.
#  nodename                          Hostname
#  outlinecolor      (color)         Change outline color
#  pre_exec          shell command   Executes a shell command one time before
#                                    torsmo displays anything and puts output
#                                    as text.
#  processes                         Total processes (sleeping and running)
#  running_processes                 Running processes (not sleeping),
#                                    requires Linux 2.6
#  shadecolor        (color)         Change shading color
#  stippled_hr       (space),        Stippled (dashed) horizontal line
#                    (height)
#  swapbar           (height)        Bar that shows amount of swap in use
#  swap                              Amount of swap in use
#  swapmax                           Total amount of swap
#  swapperc                          Percentage of swap in use
#  sysname                           System name, Linux for example
#  temp1                             Temperature #1 from i2c-sensors, same as
#                                    ${i2c temp 1}
#  temp2                             Temperature #2 from i2c-sensors, same as
#                                    ${i2c temp 2}
#  time              (format)        Local time, see man strftime to get more
#                                    information about format
#  totaldown         net             Total download, overflows at 4 GB on
#                                    Linux with 32-bit arch and there doesn't
#                                    seem to be a way to know how many times
#                                    it has already done that before torsmo
#                                    has started.
#  totalup           net             Total upload, this one too, may overflow
#  updates                           Number of updates (for debugging)
#  upspeed           net             Upload speed in kilobytes
#  upspeedf          net             Upload speed in kilobytes with one
#                                    decimal
#  uptime                            Uptime
#  uptime_short                      Uptime in a shorter format


# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument

# stuff after 'TEXT' will be formatted on screen

# ${color}$hr
# ${color}Mails: ${color slategrey}$mails${color} New: ${color slategrey}$new_mails${color}    |      ${color}Battery:${color slategrey} ${battery} %


#${color white}$nodename 
#${color white}${time %A,%e %B %G %Z  %H:%M:%S}  ${color}UpTime: ${color white}$uptime${color} 
#${color white}$sysname $kernel on $machine${color} ${color}Network:${color} Up:${color white} ${upspeed eth0} k/s${color} - Down:${color white} ${downspeed eth0} k/s
#$hr
#${color}CPU:${color white} $cpu%${color} (${color white}${loadavg 1} ${loadavg 2} ${loadavg 3}${color}) ${cpubar 5}
#${color}RAM: ${color white} $mem/$memmax - $memperc%${color} ${membar 5}
#${color}Swap:${color white} $swap/$swapmax - $swapperc%${color} ${swapbar 5}
#${color}hdb1:  ${color white}${fs_used /}/${fs_size /}${color} (${color white}${fs_free_perc /}%${color} free) ${fs_bar 5/}
#${color}hda5: ${color white}${fs_used /mnt/ehdd}/${fs_size /mnt/ehdd}${color} (${color white}${fs_free_perc /mnt/ehdd}%${color} free) ${fs_bar 5/mnt/ehdd}
#${color}hdb6: ${color white}${fs_used /mnt/fhdd}/${fs_size /mnt/fhdd}${color} (${color white}${fs_free_perc /mnt/fhdd}%${color} free) ${fs_bar 5/mnt/fhdd}

TEXT
${color slate blue}${time %a, }${color }${time %B %e %G} 
${color slate blue}${time %Z,    }${color }${time %H:%M:%S}
$hr
 ${execi 40000 cal}$hr
${color slate blue}UpTime: ${color }$uptime  
$hr
${color slate blue}Net :
     ${color}Up  :${color } ${upspeed eth0} k/s
     ${color}Down:${color } ${downspeed eth0} k/s ${color} 
$hr
${color slate blue}CPU :${color } $cpu%
     $cpubar
${color slate blue}RAM :${color } $memperc% $mem/$memmax
     $membar
${color slate blue}SWAP:${color } $swapperc% $swap/$swapmax
     $swapbar
$hr
${color slate blue}ROOT:            ${color }${fs_free_perc /}% 
     ${fs_free /}/${fs_size /}
     ${fs_bar /}
${color slate blue}STUFF:           ${color }${fs_free_perc /mnt/ehdd}% 
     ${fs_free /stuff}/${fs_size /mnt/ehdd}
     ${fs_bar /stuff}
$hr
${color slate blue}Weather :${color}
${execi 1800 tweather.sh Today}
$hr
${color slate blue}Tomorrow :${color}
${execi 1800 tweather.sh Tomorrow}
$hr
And here's tweather.sh:

Code: Select all

#!/bin/bash
city="DeWitt"
link=USMI0231.html
file=/tmp/weather.txt
location=http://weather.yahoo.com/forecast/$link

lynx -accept_all_cookies -dump $location > $file
begin=`cat -n $file | grep "Currently" | cut -d ' ' -f5`
end=`expr $begin + 40`

head -n $end $file > tmp.t
tail -n 41 tmp.t > $file

case $1 in
   Today)  head -n 6 $file | sed '3d' ;;
   Tomorrow)
      begin=`cat -n $file | grep 'Today Tomorrow' | cut -d ' ' -f5`
      end=`cat -n $file | grep 'Extended' | cut -d ' ' -f5`
      num=`expr $end - $begin - 1`
      end2=`expr $begin + 7`

      head -n $end2 $file > tmp.t
      tail -n 3 tmp.t | sed 's/sky/\n sky/' | sed '4d' ;;
   *) exit ;;
esac

rm tmp.t
rm $file
Gentoo: Stage3 w/ NPTL & udev, gcc 3.4.4 full rebuild
Kernel: 2.6.15-gentoo-r1 w/ 1G-Lowmem Patch
System: Athlon XP 2.2Ghz/1GB Corsair Value/160GB, 250GB WD IDE/128MB GeForce 6800/Sony 17" Trinitron G200 @ 1280x1024x75Hz
Top
pussi
l33t
l33t
Posts: 727
Joined: Sat May 08, 2004 9:28 am
Location: Finland

  • Quote

Post by pussi » Mon Feb 07, 2005 10:40 pm

Awesome that someone finally did this! :)

Here's some tips:

You can use torsmo to view logs instead of root-tail or terminal. Just add the following in your .torsmorc:

Code: Select all

${exec tail -n <lines> <logfile>}
<lines> determines how many lines of the log file is displayed, and add the log file of you choice on <logfile>

Use gimp to decorate torsmo with some nice graphics like icons or background color. Just edit your current background image and use the edited image as your background and you might get something like this . :)

You can set the width of bars in torsmo 0.18 like this:

Code: Select all

${fs_bar <height>,<width> /}
Last edited by pussi on Tue Feb 08, 2005 5:41 pm, edited 1 time in total.
Top
tv
n00b
n00b
Posts: 15
Joined: Fri Oct 08, 2004 3:33 pm
Location: Stuttgart / Europe

  • Quote

Post by tv » Mon Feb 07, 2005 11:10 pm

Code: Select all

tv@create ~ $ cat .torsmorc 
### create:~tv/.torsmorc

double_buffer   yes
alignment       top_left
update_interval 1.0
minimum_size    0 0
draw_shades     0

draw_borders no
border_width    1
minimum_size    1018

text
${exec ~/.torsmo.sh}

Code: Select all

tv@create ~ $ cat .torsmo.sh 
#! /bin/bash

### create:~tv/.torsmo.sh
### NOTE: $MAILDIR has to be set properly!

maildirs=Inbox,ebay

uptime=$(uptime|sed -e 's/^.*\(up .*\),.*users\?.*$/\1/' -e s/://)
load=$(uptime|sed -e 's/^.*load average: \(.*\)$/\1/' -e s/,//g)
date=$(date +%Y%m%d)
time=$(date +%H%M)
sec=$(date +%S)

blink() { (($(date +%s) % 2 == 0)) && echo $*; }

echo "\
#f0b040$(</tmp/$USER/fvwm/w.name)|$(</tmp/$USER/xmms.title)
#000060$USER@$(hostname -f) $DISPLAY
#000060$date#000080$time#000060 $uptime
#000060$load
#a0b0f0$(blink $(for m in ${maildirs//,/ }
do test $(ls "$MAILDIR/$m/new"|wc -l) -eq 0 || echo -n \  ${m##*/}
done))

#404040$(inetstat)

"|expand
using torsmo 0.18 + modifications for parsing #xxxxxx colors and | aligns following text to the right.

this combination may eat more resources than builtin stuff, but so i can write .torsmo.sh and instantly see the changes, and stuff like color fading etc.

its somewhat buggy, especially if you browse to sites which contain #blah in the title but i dont bother enough to fix it :-)

if any one is interessed, ill create a patch.
Top
comprookie2000
Retired Dev
Retired Dev
User avatar
Posts: 925
Joined: Sun Jul 25, 2004 5:39 am
Location: Sun City Center, Florida
Contact:
Contact comprookie2000
Website

  • Quote

Post by comprookie2000 » Tue Feb 08, 2005 3:15 am

Thanks Arainach,works great
http://dev.gentoo.org/~dabbott/
Top
killfire
l33t
l33t
User avatar
Posts: 618
Joined: Sat Oct 04, 2003 11:48 pm
Contact:
Contact killfire
Website

  • Quote

Post by killfire » Tue Feb 08, 2005 5:07 pm

tv wrote:

Code: Select all

tv@create ~ $ cat .torsmorc 
### create:~tv/.torsmorc

double_buffer   yes
alignment       top_left
update_interval 1.0
minimum_size    0 0
draw_shades     0

draw_borders no
border_width    1
minimum_size    1018

text
${exec ~/.torsmo.sh}

Code: Select all

tv@create ~ $ cat .torsmo.sh 
#! /bin/bash

### create:~tv/.torsmo.sh
### NOTE: $MAILDIR has to be set properly!

maildirs=Inbox,ebay

uptime=$(uptime|sed -e 's/^.*\(up .*\),.*users\?.*$/\1/' -e s/://)
load=$(uptime|sed -e 's/^.*load average: \(.*\)$/\1/' -e s/,//g)
date=$(date +%Y%m%d)
time=$(date +%H%M)
sec=$(date +%S)

blink() { (($(date +%s) % 2 == 0)) && echo $*; }

echo "\
#f0b040$(</tmp/$USER/fvwm/w.name)|$(</tmp/$USER/xmms.title)
#000060$USER@$(hostname -f) $DISPLAY
#000060$date#000080$time#000060 $uptime
#000060$load
#a0b0f0$(blink $(for m in ${maildirs//,/ }
do test $(ls "$MAILDIR/$m/new"|wc -l) -eq 0 || echo -n \  ${m##*/}
done))

#404040$(inetstat)

"|expand
using torsmo 0.18 + modifications for parsing #xxxxxx colors and | aligns following text to the right.

this combination may eat more resources than builtin stuff, but so i can write .torsmo.sh and instantly see the changes, and stuff like color fading etc.

its somewhat buggy, especially if you browse to sites which contain #blah in the title but i dont bother enough to fix it :-)

if any one is interessed, ill create a patch.
this seems very anti-the point of torsmo...

at least i use it because it doesnt use up much resources (if you wanted it to you coul duse gdesklets etc..)

it doesnt even seem like you do that much new stuff anyway...

no offence meant...

killfire
my website, built in HAppS: http://dbpatterson.com
an art (oil painting) website I built a pure python backend for: http://www.lydiajohnston.com
Top
La`res
Arch/Herd Tester
Arch/Herd Tester
User avatar
Posts: 79
Joined: Mon Aug 11, 2003 11:46 pm
Location: ::0

  • Quote

Post by La`res » Tue Feb 08, 2005 5:57 pm

But is there a way to get custom colors to render in torsmo, insead of just the pre-defined ones?

I would like to have the text in torsmo complement my BG. Gradients would be even better


[edit]
I found my answer...
just put ${color #xxyyzz} and it renders. :)
[\edit]
Top
CitizenX
Apprentice
Apprentice
User avatar
Posts: 158
Joined: Sat Sep 11, 2004 2:44 am
Location: Fresno, CA

  • Quote

Post by CitizenX » Tue Feb 08, 2005 6:48 pm

I posted this a little while in the Documentation, Tips, and Tricks forum...but since there's now a topic just for torsmo tips I'll drop it in here too.


http://www.lynucs.org/index.php?screen_ ... c&p=screen

The Torsmo on the left is an offshoot of a manual tracker I had in xpad (just writing down what I last emerged and unmerged). I was asked how I did that...when I said it wasn't automatic we got thinking.....so here's what we came up with (thanks psyqil for the LAST UNMERGED line):

Code: Select all

emerge genlop
you're gonna want this...it parses your emerge.log . I'm sure you could do this rather manually but since someone's already figured out the hard parts why reinvent the wheel? :D

.torsmorc3:

Code: Select all

TEXT
    LAST EMERGED:
${execi 180 sudo genlop -ln|tail -n 3}
    LAST UNMERGED:
${execi 180 sudo genlop -un \.\*|grep \<\<\<|tail -n 3}
    LAST SYNC:
     ${execi 180 cat /var/cache/edb/dep/timestamp.chk}
    NEXT SYNC:
     Saturday @ 00:30
Play around with it and see what you can do....I'm still looking for a way to automate that last command (I've got emerge sync on a cron job). Enjoy!
Top
Fran
Guru
Guru
User avatar
Posts: 530
Joined: Sun Feb 29, 2004 3:14 pm
Location: Coruña (Spain)

  • Quote

Post by Fran » Tue Feb 08, 2005 7:48 pm

I don't know where to post this... I've made a patch to make torsmo support several maildirs. They are specified in .torsmorc like this:

Code: Select all

# mail spool
mail_spool $HOME/.maildir/in-udc:$HOME/.maildir/in-terra:$HOME/.maildir/in-teleline
I have tested it with the maildir format, and works well. I haven't tested it with mboxes, though. If someone is interested, here is the patch.
Top
crishchun
n00b
n00b
User avatar
Posts: 39
Joined: Tue Jan 25, 2005 1:37 am
Location: /home/USA/NJ

  • Quote

Post by crishchun » Fri Feb 11, 2005 2:36 am

Display XMMS info on Torsmo

I don't know if this has been done before, but I coded up a quick perl script to display the current song XMMS is playing on my Torsmo.

Step 1: You need the xmms-infopipe plugin for XMMS.

Code: Select all

$ emerge -av xmms-infopipe
Step 2: Fire up XMMS and enable the plugin, found in Preferences -> General Plugins


Step 3: Play a song and verify xmms-info (symlink), xmms-info_$USERNAME.0, and xmms_$USERNAME.0 exist in /tmp. "cat /tmp/xmms-info" to see the current song information.


Step 4: Install the XMMS::InfoPipe perl module if you don't already have it.
XMMS-InfoPipe-0.032
Step 5: Copy this xmms.pl to wherever your heart desires and modify it to your liking. (: I like to keep my scripts in my ~/.torsmo directory. Don't forget to give it execute permissions.

Code: Select all

#!/usr/bin/perl
# Perl script to display XMMS song info on Torsmo
# Requires XMMS::InfoPipe module and xmms-infopipe plugin

use XMMS::InfoPipe;

my $numArgs = $#ARGV+1;

if($numArgs != 1) {
	print "Usage error: xmms.pl [keyname]\n";
	exit;
}

else {
	my $key = $ARGV[0];
	my $xmms = XMMS::InfoPipe->new();
	my $playing = $xmms->is_playing();
	my $paused = $xmms->is_paused();

	# display info since XMMS is playing/paused
	if($playing == 1 || $paused == 1) {

		# extract song artist
		if($key eq "Artist") {
			my $title = $xmms->{info}->{Title};
			@song = split(/ - /, $title);
			my $artist = $song[0];

			#truncate long artist names
			if(length($artist) >= 30) {
				my $temp = substr($artist, 0, 30);
				$artist = $temp . "...";
			}
			print $artist , "\n";
		}

		# extract song title
		elsif($key eq "Title") {
			my $title = $xmms->{info}->{Title};
			@song = split(/ - /, $title);
			print $song[1] , "\n";		
		}

		# join position and length times, ie 2:04 / 4:50
		elsif($key eq "Time") {
			my $length = $xmms->{info}->{Time};
			my $position = $xmms->{info}->{Position};
			print $position , " / " , $length , "\n";
		}

		# format bitrate, ie 192 kbps
		elsif($key eq "Bitrate") {
			my $bitrate = $xmms->{info}->{"Current bitrate"};
			print $bitrate/1000 , " kbps\n";
		}

		# number of tunes in playlist
		elsif($key eq "Playlist") {
			my $tunes = $xmms->{info}->{"Tunes in playlist"};
			print $tunes , " tunes\n";
		}

		# print out info for other keys (case sensitive, 'cat /tmp/xmms-info')
		else {
			print $xmms->{info}->{$key} , "\n";
		}
	}

	# display status only since XMMS is not playing/paused
	else {
		if($key eq "Status") {
			print $xmms->{info}->{Status} , "\n";
		}
	}
}
Step 6: Add these lines to your ~/.torsmorc file. Change accordingly.

Code: Select all

$stippled_hr
XMMS:
 ${color grey}Status    : $color${execi 10 perl ~/.torsmo/xmms.pl Status}
 ${color grey}Playlist  : $color${execi 10 perl ~/.torsmo/xmms.pl Playlist}

 ${color grey}Title     : $color${execi 10 perl ~/.torsmo/xmms.pl Title}
 ${color grey}Artist    : $color${execi 10 perl ~/.torsmo/xmms.pl Artist}

 ${color grey}Bitrate   : $color${execi 10 perl ~/.torsmo/xmms.pl Bitrate}
 ${color grey}Time      : $color${execi 10 perl ~/.torsmo/xmms.pl Time}
$stippled_hr
I know the code's not pretty and you can tell that programming isn't my expertise, but it works. Maybe someone can optimize it. :D

The argument you pass into xmms.pl is the name of the info you want, such as Status, Position, Title.. although I modified "Title" to return the song title, "Artist" to return the song artist (since they're both on one line in xmms-info), and "Time" to display a concatenated version of Position / Time. And also truncate the artists' names since some of mine are long and it will auto expand the Torsmo window, which isn't good at all.

Code: Select all

crishchun@christian .torsmo $ cat /tmp/xmms-info
XMMS protocol version: 2467
InfoPipe Plugin version: 1.3
Status: Playing
Tunes in playlist: 314
Currently playing: 107
uSecPosition: 10093
Position: 0:10
uSecTime: 268617
Time: 4:28
Current bitrate: 192000
Samping Frequency: 44100
Channels: 2
Title: Mario f/ Jadakiss & T.I. - Let Me Love You (Remix)
File: /mnt/roselyn/shared/My Shared Folder/Mario ft Jadakiss and T.I. - Let Me Love You (Remix).mp3
Here's a screenshot of my Torsmo. Tell me what you guys think! Now all I need is some buttons to control XMMS!
Last edited by crishchun on Fri Feb 11, 2005 4:15 pm, edited 1 time in total.
Dell Inspiron 8200
1.4GHz / Pentium4 / 256MB RAM
Gentoo 2.6.11-rc4-nitro1

Current desktop
Top
crishchun
n00b
n00b
User avatar
Posts: 39
Joined: Tue Jan 25, 2005 1:37 am
Location: /home/USA/NJ

  • Quote

Post by crishchun » Fri Feb 11, 2005 3:16 pm

Display Weather.com forecast info on Torsmo

Step 1: Copy forecast.sh to wherever you want, maybe ~/.torsmo. Change accordingly (DAYS, LOCID, LOCALXMLFILE) and run it in your /etc/crontab, maybe at a 6 hour interval or so. Refer to XML.com: Rainy Day XML if you need more information on setting up the feed. Don't forget to give it execute permissions.

Code: Select all

#!/bin/bash
# forecast.sh
# Run this in your /etc/crontab

# FIND YOUR LOCID
# ---------------
# First go to: http://xoap.weather.com/search/search?where=XXXXX
# The "XXXXX" can be anything you are searching for, such as zip code, city, state, or country.
# After loading that web page up you should have a search returned with a "loc id".
# The "loc id" will be used for your # weather.

DAYS="4"
LOCID="08872"
PARTNERID="1003666583"
LICENSEKEY="4128909340a9b2fc"
XMLFEED="http://xoap.weather.com/weather/local/"
XMLFILE="$XMLFEED$LOCID?dayf=$DAYS&prod=xoap&par=$PARTNERID&key=$LICENSEKEY"
LOCALXMLFILE="/home/username/.torsmo/forecast.xml"

wget -N $XMLFILE -O $LOCALXMLFILE
Step 2: Obtain and install the XML::Simple perl module if you don't already have it.
XML::Simple requires either XML::Parser or XML::SAX.
Step 3: Copy forecast.pl to wherever you want, maybe the same directory as forecast.sh. Change $xmlfile to the match forecash.sh's LOCALXMLFILE. Give it execute permissions.

Code: Select all

#!/usr/bin/perl
# forecast.pl

use XML::Simple;

my $xmlfile = "/home/username/.torsmo/forecast.xml";
my $xml = XMLin($xmlfile);

my $numArgs = $#ARGV+1;
my $arg = $ARGV[0];

if ($numArgs == 1) {
	if ($arg eq "updated") {
		print $xml->{dayf}->{lsup} . "\n";
	}
	else {
		print $xml->{loc}->{$arg} . "\n";
	}
	exit;
}

elsif ($numArgs == 2) {
	my $day = $ARGV[0];
	my $info = $ARGV[1];
	if ($info eq "condday") {
		print $xml->{dayf}->{day}->[$day]->{part}->[0]->{t} . "\n";
	}
	elsif ($info eq "condnight") {
		print $xml->{dayf}->{day}->[$day]->{part}->[1]->{t} . "\n";
	}
	else {
		print $xml->{dayf}->{day}->[$day]->{$info} . "\n";
	}
}
Step 4: Add these lines to your ~/.torsmorc file. Change accordingly.

Code: Select all

$stippled_hr
FORECAST:
 ${color grey}Updated     : $color${execi 1800 perl ~/.torsmo/forecast.pl updated}
 ${color grey}Location    : $color${execi 1800 perl ~/.torsmo/forecast.pl dnam}
 ${color grey}Sunrise     : $color${execi 1800 perl ~/.torsmo/forecast.pl sunr}
 ${color grey}Sunset      : $color${execi 1800 perl ~/.torsmo/forecast.pl suns}

 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 1 t}
 ${color grey}High        : $color${execi 1800 perl ~/.torsmo/forecast.pl 1 hi} F
 ${color grey}Low         : $color${execi 1800 perl ~/.torsmo/forecast.pl 1 low} F
 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 1 condday}
 ${color grey}Night       : $color${execi 1800 perl ~/.torsmo/forecast.pl 1 condnight}

 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 2 t}
 ${color grey}High        : $color${execi 1800 perl ~/.torsmo/forecast.pl 2 hi} F
 ${color grey}Low         : $color${execi 1800 perl ~/.torsmo/forecast.pl 2 low} F
 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 2 condday}
 ${color grey}Night       : $color${execi 1800 perl ~/.torsmo/forecast.pl 2 condnight}

 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 3 t}
 ${color grey}High        : $color${execi 1800 perl ~/.torsmo/forecast.pl 3 hi} F
 ${color grey}Low         : $color${execi 1800 perl ~/.torsmo/forecast.pl 3 low} F
 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 3 condday}
 ${color grey}Night       : $color${execi 1800 perl ~/.torsmo/forecast.pl 3 condnight}
$stippled_hr
forecast.pl usage: forecast.pl [arg1] [arg2], where [arg1] is the day you want (0 is today, 1 is tomorrow, etc.) and [arg2] is the xml tag you want to extract. I added "condday" and "condnight" to facilate getting the day and night conditions, respectively. If sent only one argument, it returns the current information. Just have a look at the generated forecast.xml and play around with it to extract the values you want.

Here's a screenshot of my Torsmo.
Dell Inspiron 8200
1.4GHz / Pentium4 / 256MB RAM
Gentoo 2.6.11-rc4-nitro1

Current desktop
Top
crishchun
n00b
n00b
User avatar
Posts: 39
Joined: Tue Jan 25, 2005 1:37 am
Location: /home/USA/NJ

  • Quote

Post by crishchun » Fri Feb 11, 2005 4:35 pm

Display your Gmail info on Torsmo

Step 1: Obtain and install the Mail::Webmail::Gmail and GMail::Checker perl modules.

Step 2: Copy gmail.pl to wherever you want, maybe ~/.torsmo. Change accordingly ($username, $password, and $gmailfile), chmod +x gmail.pl, and run it in your /etc/crontab, maybe at a 5 minute interval or so.

Code: Select all

#!/usr/bin/perl
# gmail.pl

use Mail::Webmail::Gmail;
use GMail::Checker;

my $username = "user.name"; # your Gmail username
my $password = "password"; # your Gmail password
my $gmailfile = "/home/username.torsmo/gmail.txt";
my $newmessages = 0;
my @subjects = ();

my $gwrapper = new GMail::Checker();
$gwrapper->login($username, $password);
my ($totalmessages, $usedspace) = $gwrapper->get_msg_nb_size();
$gwrapper->close();

my $gmail = Mail::Webmail::Gmail->new(
	username => $username, password => $password, encrypt_session => 1
);
my ($usage, $capacity, $usagep) = $gmail->size_usage();
my $messages = $gmail->get_messages(
	label => $Mail::Webmail::Gmail::FOLDERS{ 'INBOX' }
);

foreach ( @{ $messages } ) {
	if ( $_->{ 'new' } ) {
		$newmessages += 1;
		my $subject = $_->{ 'subject' };
		$subject =~ s/<(.*?)>//gi; # remove <b> tags
		push(@subjects, $subject);
	}
}

open(FD, "> " . $gmailfile) or die("Could not open file.\n");
	print FD "totalmessages=" . $totalmessages . "\n";
	print FD "newmessages=" . $newmessages . "\n";
	print FD "status=Using " . $usage . " (" . $usagep . ") of " . $capacity . "\n";
	for($i=0; $i<=$#subjects; $i++) {
		print FD $subjects[$i] . "\n";
	}
close(FD);
Step 3: gmail.pl will produce gmail.txt in the following format:

Code: Select all

crishchun@christian ~ $ cat ~/.torsmo/gmail.txt
totalmessages=263
newmessages=3
status=Using 33 MB (3%) of 1000 MB
Find for the designer
Fwd: Keona Ariana Paler
Fwd: thank you
Step 4: Copy gmail_extract.pl to wherever you want, maybe the same directory as gmail.pl. Change $file to the match gmail.pl's $gmailfile.

Code: Select all

#!/usr/bin/perl
# gmail_extract.pl

my $numArgs = $#ARGV+1;

if($numArgs != 1) {
	die ("Usage error: gmail_extract.pl [info]\n");
	exit;
}

else {
	my $file = "/home/username/.torsmo/gmail.txt";
	my $arg = $ARGV[0];
	open (HANDLE, $file) or die ("Could not open file.");
	@LINES = <HANDLE>;

	if ($arg eq "newsubjects") {
		$line = $LINES[1];
		my ($foo, $newmessages) = split(/=/, $line);
		if($newmessages > 0) {
			for($i=3; $i<=$#LINES; $i++) {
				my $num = $i-2;
				my $sub = $LINES[$i];
				
				# truncate long subjects so it will not
				# autoexpand the tormso window
				if(length($sub) >= 40) {
					my $temp = substr($sub, 0, 40);
					$sub = $temp . "...\n";
				}
				print " " . $num . ". " . $sub;
			}
		}
	}

	# how many total message do I have?
	if($arg eq "totalmessages") {
		$line = $LINES[0];
		my ($foo, $total) = split(/=/, $line);
		$total =~ s/[\r\n]//g; # remove \n
		print "There are " . $total . " messages\n";
	}

	# how many new messages do I have?
	if($arg eq "newmessages") {
		$line = $LINES[1];
		my ($foo, $new) = split(/=/, $line);
		$new =~ s/[\r\n]//g; # remove \n
		if($new == 0) { print "There are no new messages\n"; }
		elsif($new == 1) { print "There is one new message\n"; }
		else { print "There are " . $new . " new messages\n"; }
	}

	# usage status
	if($arg eq "status") {
		$line = $LINES[2];
		my ($foo, $retval) = split(/=/, $line);
		print $retval;
	}

	close (HANDLE);
}
Step 4: Add these lines to your ~/.torsmorc file. Change accordingly.

Code: Select all

GMAIL:
 ${color grey}Status      : $color${execi 300 perl ~/.torsmo/gmail_extract.pl status}
 ${color grey}Messages    : $color${execi 300 perl ~/.torsmo/gmail_extract.pl totalmessages}
 ${color grey}New         : $color${execi 300 perl ~/.torsmo/gmail_extract.pl newmessages}

$color${execi 300 perl ~/.torsmo/gmail_extract.pl newsubjects}
Have a look at Mail::Webmail::Gmail documentation to extract more info, such as sender, date, etc. If someone can pick at the code and figure out how to get the total messages without the GMail::Checker module, that would be great! Here's a screenshot of my Torsmo.


### EDIT ###
Requirements for Mail::Webmail::Gmail
lib qw(lib)
LWP::UserAgent
HTTP::Headers
HTTP::Cookies
HTTP::Request::Common
http://search.cpan.org/~gaas/libwww-perl-5.803/

Crypt::SSLeay
http://search.cpan.org/~chamas/Crypt-SSLeay-0.51/

Exporter
http://search.cpan.org/~nwclark/perl-5. ... xporter.pm
Requirements for GMail::Checker
IO::Socket:SSL
http://search.cpan.org/~behroozi/
Last edited by crishchun on Wed Feb 16, 2005 5:12 pm, edited 2 times in total.
Dell Inspiron 8200
1.4GHz / Pentium4 / 256MB RAM
Gentoo 2.6.11-rc4-nitro1

Current desktop
Top
psycovic
Apprentice
Apprentice
Posts: 172
Joined: Wed Jun 23, 2004 5:51 pm
Contact:
Contact psycovic
Website

  • Quote

Post by psycovic » Fri Feb 11, 2005 6:47 pm

crishchun wrote:Display Weather.com forecast info on Torsmo

Step 1: Copy forecast.sh to wherever you want, maybe ~/.torsmo. Change accordingly (DAYS, LOCID, LOCALXMLFILE) and run it in your /etc/crontab, maybe at a 6 hour interval or so. Refer to XML.com: Rainy Day XML if you need more information on setting up the feed. Don't forget to give it execute permissions.

Code: Select all

#!/bin/bash
# forecast.sh
# Run this in your /etc/crontab

# FIND YOUR LOCID
# ---------------
# First go to: http://xoap.weather.com/search/search?where=XXXXX
# The "XXXXX" can be anything you are searching for, such as zip code, city, state, or country.
# After loading that web page up you should have a search returned with a "loc id".
# The "loc id" will be used for your # weather.

DAYS="4"
LOCID="08872"
PARTNERID="1003666583"
LICENSEKEY="4128909340a9b2fc"
XMLFEED="http://xoap.weather.com/weather/local/"
XMLFILE="$XMLFEED$LOCID?dayf=$DAYS&prod=xoap&par=$PARTNERID&key=$LICENSEKEY"
LOCALXMLFILE="/home/username/.torsmo/forecast.xml"

wget -N $XMLFILE -O $LOCALXMLFILE
Step 2: Obtain and install the XML::Simple perl module if you don't already have it.
XML::Simple requires either XML::Parser or XML::SAX.
Step 3: Copy forecast.pl to wherever you want, maybe the same directory as forecast.sh. Change $xmlfile to the match forecash.sh's LOCALXMLFILE. Give it execute permissions.

Code: Select all

#!/usr/bin/perl
# forecast.pl

use XML::Simple;

my $xmlfile = "/home/username/.torsmo/forecast.xml";
my $xml = XMLin($xmlfile);

my $numArgs = $#ARGV+1;
my $arg = $ARGV[0];

if ($numArgs == 1) {
	if ($arg eq "updated") {
		print $xml->{dayf}->{lsup} . "\n";
	}
	else {
		print $xml->{loc}->{$arg} . "\n";
	}
	exit;
}

elsif ($numArgs == 2) {
	my $day = $ARGV[0];
	my $info = $ARGV[1];
	if ($info eq "condday") {
		print $xml->{dayf}->{day}->[$day]->{part}->[0]->{t} . "\n";
	}
	elsif ($info eq "condnight") {
		print $xml->{dayf}->{day}->[$day]->{part}->[1]->{t} . "\n";
	}
	else {
		print $xml->{dayf}->{day}->[$day]->{$info} . "\n";
	}
}
Step 4: Add these lines to your ~/.torsmorc file. Change accordingly.

Code: Select all

$stippled_hr
FORECAST:
 ${color grey}Updated     : $color${execi 1800 perl ~/.torsmo/forecast.pl updated}
 ${color grey}Location    : $color${execi 1800 perl ~/.torsmo/forecast.pl dnam}
 ${color grey}Sunrise     : $color${execi 1800 perl ~/.torsmo/forecast.pl sunr}
 ${color grey}Sunset      : $color${execi 1800 perl ~/.torsmo/forecast.pl suns}

 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 1 t}
 ${color grey}High        : $color${execi 1800 perl ~/.torsmo/forecast.pl 1 hi} F
 ${color grey}Low         : $color${execi 1800 perl ~/.torsmo/forecast.pl 1 low} F
 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 1 condday}
 ${color grey}Night       : $color${execi 1800 perl ~/.torsmo/forecast.pl 1 condnight}

 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 2 t}
 ${color grey}High        : $color${execi 1800 perl ~/.torsmo/forecast.pl 2 hi} F
 ${color grey}Low         : $color${execi 1800 perl ~/.torsmo/forecast.pl 2 low} F
 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 2 condday}
 ${color grey}Night       : $color${execi 1800 perl ~/.torsmo/forecast.pl 2 condnight}

 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 3 t}
 ${color grey}High        : $color${execi 1800 perl ~/.torsmo/forecast.pl 3 hi} F
 ${color grey}Low         : $color${execi 1800 perl ~/.torsmo/forecast.pl 3 low} F
 ${color grey}Day         : $color${execi 1800 perl ~/.torsmo/forecast.pl 3 condday}
 ${color grey}Night       : $color${execi 1800 perl ~/.torsmo/forecast.pl 3 condnight}
$stippled_hr
forecast.pl usage: forecast.pl [arg1] [arg2], where [arg1] is the day you want (0 is today, 1 is tomorrow, etc.) and [arg2] is the xml tag you want to extract. I added "condday" and "condnight" to facilate getting the day and night conditions, respectively. If sent only one argument, it returns the current information. Just have a look at the generated forecast.xml and play around with it to extract the values you want.

Here's a screenshot of my Torsmo.
How'd you get the colon's to line up straight?
Top
crishchun
n00b
n00b
User avatar
Posts: 39
Joined: Tue Jan 25, 2005 1:37 am
Location: /home/USA/NJ

  • Quote

Post by crishchun » Sat Feb 12, 2005 5:05 am

psycovic wrote:How'd you get the colon's to line up straight?
My .torsmorc has font 6x10 and I just placed spaces manually before each colon. It also helps if you have a monospaced font in your terminal or text editor.
Dell Inspiron 8200
1.4GHz / Pentium4 / 256MB RAM
Gentoo 2.6.11-rc4-nitro1

Current desktop
Top
tv
n00b
n00b
Posts: 15
Joined: Fri Oct 08, 2004 3:33 pm
Location: Stuttgart / Europe

  • Quote

Post by tv » Sat Feb 12, 2005 3:28 pm

killfire wrote:this seems very anti-the point of torsmo...

at least i use it because it doesnt use up much resources (if you wanted it to you coul duse gdesklets etc..)
i use it because it fits to my X environment.
torsmo replaces root-tail and any other "notification" application on my desktop (for the console irssi does all of this :-)), i can extend it on-the-fly and it doesnt use much resources, afaict less than an open xterm.
killfire wrote:it doesnt even seem like you do that much new stuff anyway...
not much, but a "|" in the text area of torsmorc will align the rest of the line to the right, since you cant have two torsmos open when double buffering and i wanted to have my window title top-left and the title of current playing song top-right.
Top
thepi
Guru
Guru
User avatar
Posts: 352
Joined: Tue Jan 06, 2004 10:57 pm
Location: Tokyo, Japan

  • Quote

Post by thepi » Sat Feb 12, 2005 7:21 pm

Very interesting thread, really :) I think I gotta recheck my .torsmorc soon, esp. the genlop combination. I'm still waiting for the day though that it supports having a (transparent :P) background field.

pi~
Violence is the last resort of the incompetent --Isaac Asimov
Gentoo on Acer TM800 | Help! | Vote! | Get FF!
Top
enigma_0Z
Guru
Guru
User avatar
Posts: 531
Joined: Sun Aug 29, 2004 1:06 pm
Location: Either lurking here or at my forum (see sig)
Contact:
Contact enigma_0Z
Website

  • Quote

Post by enigma_0Z » Sat Feb 12, 2005 7:55 pm

I'm sorry, this is gonna sound really stupid but, here goes...

How can I add a cron job? I'd like to add the gmail checker to my .torsmorc
Check out my...
Website: (CURRENTLY DOWN) http://sledgehammer.ath.cx
Forum: (ALSO CURRRENTLY DOWN) http://sledgehammer.ath.cx/forum/
Top
stgreek
Apprentice
Apprentice
User avatar
Posts: 155
Joined: Sun Jan 18, 2004 6:08 pm
Location: Guildford, UK
Contact:
Contact stgreek
Website

  • Quote

Post by stgreek » Sat Feb 12, 2005 8:28 pm

enigma_0Z wrote:I'm sorry, this is gonna sound really stupid but, here goes...

How can I add a cron job? I'd like to add the gmail checker to my .torsmorc
Add your user to the "cron" group, then do:

Code: Select all

crontab -e username
then add the job you want.

For example, if you want to check your gmail every 5 minutes, put this in your crontab:

Code: Select all

*/5 * * * * /home/username/.torsmo/gmail.pl
Might not be the best way, but it works for me.
The day Microsoft makes something that doesn't suck is probably the day that they start making vacuum cleaners
Top
|cub|
n00b
n00b
User avatar
Posts: 59
Joined: Sat Feb 12, 2005 11:49 pm
Location: UA

  • Quote

Post by |cub| » Sun Feb 13, 2005 12:15 am

Sorry for a question, but my torsmo says to me

Code: Select all

 $ torsmo
Floating point exception
What should i do to fix it? Can any one help?
Top
enigma_0Z
Guru
Guru
User avatar
Posts: 531
Joined: Sun Aug 29, 2004 1:06 pm
Location: Either lurking here or at my forum (see sig)
Contact:
Contact enigma_0Z
Website

  • Quote

Post by enigma_0Z » Sun Feb 13, 2005 3:56 pm

Another perl question:

Any time I try to run gmail.pl, it says:

Code: Select all

$ ./gmail.pl
Can't locate LWP/UserAgent.pm in @INC (@INC contains: lib /etc/perl /usr/lib/perl5/site_perl/5.8.5/i686-linux /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.4/i686-linux /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.5/i686-linux /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.4/i686-linux /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.5/i686-linux /usr/lib/perl5/5.8.5 /usr/local/lib/site_perl .) at /usr/lib/perl5/site_perl/5.8.5/Mail/Webmail/Gmail.pm line 6.
Compilation failed in require at ./gmail.pl line 4.
BEGIN failed--compilation aborted at ./gmail.pl line 4.
What do I need to emerge to get this working?
Check out my...
Website: (CURRENTLY DOWN) http://sledgehammer.ath.cx
Forum: (ALSO CURRRENTLY DOWN) http://sledgehammer.ath.cx/forum/
Top
crishchun
n00b
n00b
User avatar
Posts: 39
Joined: Tue Jan 25, 2005 1:37 am
Location: /home/USA/NJ

  • Quote

Post by crishchun » Sun Feb 13, 2005 4:27 pm

Looks like you're missing the LWP::UserAgent module. Download from here: http://search.cpan.org/~gaas/libwww-perl-5.803/ and install it.
Dell Inspiron 8200
1.4GHz / Pentium4 / 256MB RAM
Gentoo 2.6.11-rc4-nitro1

Current desktop
Top
psycovic
Apprentice
Apprentice
Posts: 172
Joined: Wed Jun 23, 2004 5:51 pm
Contact:
Contact psycovic
Website

  • Quote

Post by psycovic » Sun Feb 13, 2005 4:32 pm

I can't get cron to work...I just emerged dcron, and I added myself to the cron group by editing /etc/groups, and when I type groups, it shows up...but it won't run it. My cron list is

Code: Select all

*/5 * * * * ~/.torsmo/email
* */2 * * * ~/.torsmo/gmail.pl
* */6 * * * ~/.torsmo/forecast.sh
Any ideas?
Top
crishchun
n00b
n00b
User avatar
Posts: 39
Joined: Tue Jan 25, 2005 1:37 am
Location: /home/USA/NJ

  • Quote

Post by crishchun » Sun Feb 13, 2005 4:53 pm

psycovic wrote:I can't get cron to work...I just emerged dcron, and I added myself to the cron group by editing /etc/groups, and when I type groups, it shows up...but it won't run it. My cron list is

Code: Select all

*/5 * * * * ~/.torsmo/email
* */2 * * * ~/.torsmo/gmail.pl
* */6 * * * ~/.torsmo/forecast.sh
Any ideas?
Hmm.. I'm still not sure how to set up cron with users and groups, but I just put the my cron jobs in /etc/crontab and it works fine. I have gmail.pl running every five minutes. Here's mine.

Code: Select all

crishchun@apertur3 ~ $ cat /etc/crontab
# for vixie cron
#
# $Header: /var/cvsroot/gentoo-x86/sys-apps/vixie-cron/files/crontab-3.0.1-r4,v 1.6 2004/07/18 04:40:50 dragonheart Exp $
#
#

# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly
0  *  * * *     root    rm -f /var/spool/cron/lastrun/cron.hourly
1  3  * * *     root    rm -f /var/spool/cron/lastrun/cron.daily
15 4  * * 6     root    rm -f /var/spool/cron/lastrun/cron.weekly
30 5  1 * *     root    rm -f /var/spool/cron/lastrun/cron.monthly
*/10  *  * * *  root    test -x /usr/sbin/run-crons && /usr/sbin/run-crons

# My cron jobs
45 0 * * *      root    emerge sync >> /tmp/cron_sync.log 2>&1
0 1 * * *       root    eupdatedb >> /tmp/cron_eupdatedb.log 2>&1
0 * * * *       root    ntpdate sundial.columbia.edu >> /tmp/cron_ntpdate.log 2> &1
0,30 * * * *   root     /home/crishchun/.torsmo/forecast.sh 2>&1
5,35 * * * *   root     /home/crishchun/.torsmo/weather.sh 2>&1
0-59/5 * * * * root     perl /home/crishchun/.torsmo/gmail.pl 2>&1
Dell Inspiron 8200
1.4GHz / Pentium4 / 256MB RAM
Gentoo 2.6.11-rc4-nitro1

Current desktop
Top
psycovic
Apprentice
Apprentice
Posts: 172
Joined: Wed Jun 23, 2004 5:51 pm
Contact:
Contact psycovic
Website

  • Quote

Post by psycovic » Sun Feb 13, 2005 5:41 pm

crishchun wrote:
psycovic wrote:I can't get cron to work...I just emerged dcron, and I added myself to the cron group by editing /etc/groups, and when I type groups, it shows up...but it won't run it. My cron list is

Code: Select all

*/5 * * * * ~/.torsmo/email
* */2 * * * ~/.torsmo/gmail.pl
* */6 * * * ~/.torsmo/forecast.sh
Any ideas?
Hmm.. I'm still not sure how to set up cron with users and groups, but I just put the my cron jobs in /etc/crontab and it works fine. I have gmail.pl running every five minutes. Here's mine.

Code: Select all

crishchun@apertur3 ~ $ cat /etc/crontab
# for vixie cron
#
# $Header: /var/cvsroot/gentoo-x86/sys-apps/vixie-cron/files/crontab-3.0.1-r4,v 1.6 2004/07/18 04:40:50 dragonheart Exp $
#
#

# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly
0  *  * * *     root    rm -f /var/spool/cron/lastrun/cron.hourly
1  3  * * *     root    rm -f /var/spool/cron/lastrun/cron.daily
15 4  * * 6     root    rm -f /var/spool/cron/lastrun/cron.weekly
30 5  1 * *     root    rm -f /var/spool/cron/lastrun/cron.monthly
*/10  *  * * *  root    test -x /usr/sbin/run-crons && /usr/sbin/run-crons

# My cron jobs
45 0 * * *      root    emerge sync >> /tmp/cron_sync.log 2>&1
0 1 * * *       root    eupdatedb >> /tmp/cron_eupdatedb.log 2>&1
0 * * * *       root    ntpdate sundial.columbia.edu >> /tmp/cron_ntpdate.log 2> &1
0,30 * * * *   root     /home/crishchun/.torsmo/forecast.sh 2>&1
5,35 * * * *   root     /home/crishchun/.torsmo/weather.sh 2>&1
0-59/5 * * * * root     perl /home/crishchun/.torsmo/gmail.pl 2>&1
Well, I did that (although I left out 'root', and just had my command..does that matter?) and it still doesn't work. Is there anyway to force a cronjob to run?

# to get /etc/cron.{hourly|daily|weekly|montly} working with fcron or dcron do
# crontab /etc/crontab
# as root.
# NOTE: This will REPLACE root's current crontab!!


# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly

*/15 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons
0 * * * * rm -f /var/spool/cron/lastrun/cron.hourly
0 3 * * * rm -f /var/spool/cron/lastrun/cron.daily
15 4 * * 6 rm -f /var/spool/cron/lastrun/cron.weekly
30 5 1 * * rm -f /var/spool/cron/lastrun/cron.monthly
*/5 * * * * ~/.torsmo/email
* */2 * * * perl ~/.torsmo/gmail.pl
* */6 * * * ~/.torsmo/forecast.sh
Top
crishchun
n00b
n00b
User avatar
Posts: 39
Joined: Tue Jan 25, 2005 1:37 am
Location: /home/USA/NJ

  • Quote

Post by crishchun » Sun Feb 13, 2005 6:14 pm

psycovic wrote:Well, I did that (although I left out 'root', and just had my command..does that matter?) and it still doesn't work. Is there anyway to force a cronjob to run?

# to get /etc/cron.{hourly|daily|weekly|montly} working with fcron or dcron do
# crontab /etc/crontab
# as root.
# NOTE: This will REPLACE root's current crontab!!


# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly

*/15 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons
0 * * * * rm -f /var/spool/cron/lastrun/cron.hourly
0 3 * * * rm -f /var/spool/cron/lastrun/cron.daily
15 4 * * 6 rm -f /var/spool/cron/lastrun/cron.weekly
30 5 1 * * rm -f /var/spool/cron/lastrun/cron.monthly
*/5 * * * * ~/.torsmo/email
* */2 * * * perl ~/.torsmo/gmail.pl
* */6 * * * ~/.torsmo/forecast.sh
Interesting. Does it work with root in? I'm using vixiecron so I don't know if it's any different than dcron. Did you refer to the gentoo docs? http://www.gentoo.org/doc/en/cron-guide.xml
Dell Inspiron 8200
1.4GHz / Pentium4 / 256MB RAM
Gentoo 2.6.11-rc4-nitro1

Current desktop
Top
psycovic
Apprentice
Apprentice
Posts: 172
Joined: Wed Jun 23, 2004 5:51 pm
Contact:
Contact psycovic
Website

  • Quote

Post by psycovic » Sun Feb 13, 2005 6:22 pm

*Smacks self*

I didn't start the dcron service.

*Smacks self again*
Top
Post Reply

223 posts
  • Page 1 of 9
    • Jump to page:
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 9
  • Next

Return to “Desktop Environments”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy