This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

a little exec problem

Old posts that have not been replied to for several years.
Locked
M
MasterJM
Halfop
Posts: 56
Joined: Wed Apr 03, 2002 8:00 pm
Location: germany
Contact:

a little exec problem

Post by MasterJM »

hi

i want to start pisg (the irc chan stats) per trigger from pub

this works:
set update_setting(flag) "S"
set update_setting(cmd) "!update"
set update_setting(exec) "/home/masterjm/pisg/pisg"
set update_setting(msg) "stats updated -> url"

bind pub $update_setting(flag) $update_setting(cmd) pub:update

proc pub:update {nick uhost hand chan text} {
global update_setting
puthelp "PRIVMSG $chan :[expr {[catch {exec $update_setting(exec)} error]?"$update_setting(exec) could not be executed ([string totitle $error]).":$update_setting(msg)}]"
}

this works

but i want to support more than one channel / pisg.cfg file
so i need this:

set update_setting(exec2) "/home/masterjm/pisg/pisg --configfile=/home/masterjm/pisg/2.cfg"

[for an other channel an other cfg file]

but with this setting the eggdrop dont run pisg
if i try it over irc pub trigger the eggdrop says:
/home/masterjm/pisg/pisg --configfile=/home/masterjm/pisg/2.cfg could not be executed (Couldn't execute "/home/masterjm/pisg/pisg --configfile=/home/masterjm/pisg/morfi.cfg": no such file or directory).

(but the file and the directory are fine - in bash of the shell this works!)

any ideas?

thx :)
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Warning - it's 2:30pm and i'm drunk (xmas party today), so take my posts light hartedly.

THe exec command, executes things literaly, out doesn't require the escaping that is normaly required on the shell.

IE, if the is a space in a filename, you don't need to escape it.

Using this rule, you will notice that the command, is being executed, with the though that the space is in the filename, and not in the command.

My sugestion would be to change your command, so that the program name and directory and the arguemnts are seperate.

EG. have a single static command, with the program name pointing to psig. And then a seperate variable for each channel, with the arguemnts.
Locked