[mICQ] micq and crontab !

Jeff MacLoue jeff at macloue.org.ua
Tue Aug 28 08:51:11 CEST 2007


On Mon, 27 Aug 2007, Luiz Gustavo Sarubi Macchi (Gugui) wrote:

LGSMG> Hi all, i need to send a message every day !
LGSMG> 
LGSMG> how to run micq on crontab ?
LGSMG> 
LGSMG> i was thinking
LGSMG> 
LGSMG> a txt file:
LGSMG> 
LGSMG> !sleep 10  # to wait icq to became on-line
LGSMG> msg uin message
LGSMG> !sleep 10 # to wait send the message
LGSMG> q   # to quit micq
LGSMG> 
LGSMG> so !sleep 10 force a pause and micq stop running for 10 seconds, so it 
LGSMG> cant stay on-line :-(
LGSMG> 
LGSMG> thanks any help

Why don't you use remote control socket?

mICQ keeps a socket inside its directory, called "scripting" in newer 
releases and "remote-control" (if I am not mistaken) in older ones (or if 
you use old config - check micqrc). Everything written to this socket will 
be executed as it was typed in mICQ command line.

To use this feature you need some way to keep mICQ running - I don't think 
it will like usual '&' as it needs screen output. I think the better way 
is to use "screen" application to emulate the terminal - check if it is 
available in your system.

So, to send a message from an external script you need smth like:

===
#!/bin/sh

# Run mICQ in virtual terminal:

screen -d -m micq

# ('-d -m' means detached mode)

# Wait for logon to complete:

sleep 20

# Send the message:

echo 'msg Contact "Hi, friend!"' > $HOME/.micq/scripting

# Wait a while:

sleep 10

# And finally quit mICQ:

echo 'q' > $HOME/.micq/scripting
===

I didn't tried this script but I think it will work.



P.S. A general thought - it would be better to have some "feedback" from 
scripting socket. "sleep" is not the best way to do the things actually, 
and despite Tcl scripting feature can do way better things it is not 
documented fine enough (or I didn't find the docs). I wrote a very basic 
cover of this feature, it's available at 
http://www.macloue.com/micq/micq-Tcl-HOWTO.txt but it needs enhancements 
and editorial I don't have time to perform at the moment. Suggestions, 
fixes and additions are welcome.

--
jeff


More information about the mICQ-List mailing list