Code: Select all
echo write #chan Clearing $dir >> /path/to/the/pipe
Code: Select all
#!/bin/sh
find *.txt >> fils.lst
rm -f *.txt
dir=`pwd`
return 1
Code: Select all
set foo [exec maihappyness.sh] .. if {[info exists foo]} { putserv hi2u }}
Code: Select all
% set foo [exec lalala]
couldn't execute "lalala": no such file or directory
% set foo
can't read "foo": no such variable
Code: Select all
% set foo [exec ./test.sh]
./test.sh: line 2: return: can only `return' from a function or sourced script
Could you possibly describe how to set up the listener within eggdrop in a bit more detail? I'm new to the whole eggdrop thing. I'm trying to get a script to notify a channel when something external happens, if there's a better way to handle this then please let me know. Much appreciated.nml375 wrote:I guess you could consider using named pipes to communicate with your eggdrop that way.
In that case, you'd have to set up a "listener" within your eggdrop (open, fconfigure, fileevent, gets, eof) to listen at the pipe, and take appropriate actions upon incoming transmissions.
In order to transmit to your eggdrop, it would be a mere matter ofAlso see the manpage for mkfifo for further information on named pipes.Code: Select all
echo write #chan Clearing $dir >> /path/to/the/pipe
Code: Select all
listen 12345 script IncomingConnection
proc IncomingConnection {idx} {
#We've got a new incoming connection, hand it over to our "handler"
control $idx IncomingTransmission
}
proc IncomingTransmission {idx text} {
#Did we recieve a new line, or did the remote end close the connection?
if {$text != ""} {
#Slit the text into a list and retrieve the command..
set data [split $text]
set command [lindex $data 0]
#.. and see what we're supposed to do.
#Hint: this would be a nice place to add a command for authentication...
switch $command {
write {
#Use list-element 1 as channel, and the rest as the message to be sent
#Considder adding a check whether the connection has authenticated or not yet.
#Atleast we do check that it's a valid channel..
if {[validchan [set chan [lindex $data 1]]]} {
puthelp "PRIVMSG $chan :[join [lrange $data 2 end]]"
}
}
}
} else {
#remote connection closed, do some cleanup here if needed
#Hint: here you would un-authenticate the idx (connection identifier)
#For now tho, we'll just do a putlog for fun
putlog "Remote connection $idx dropped"
}
}
Code: Select all
#simple case, where we have no authentication or such:
echo "write #mychan Cleaning $dir" | nc localhost 12345
#Lets imagine we've implemented an authenticate-command that has to be issued before write...
#Send multiple commands like this:
nc localhost 12345 <<EOF
authenticate mysecretpassword
write #mychan Clearing $dir
EOF
Code: Select all
listen 12345 IncomingConnection
Code: Select all
listen 12345 script IncomingConnection