View Single Post
Old 12-07-2005, 10:11 PM  
EwarWoo
Senior Member
 
Join Date: Oct 2002
Posts: 462
Default Anyone help me with TCL please?

I'm trying to bodge together a little bot script, however having never used TCL before I'm struggling and I'm sure my syntax is completely whacked. I'm trying to bodge a script to restart ioFTPD if its down:

Code:
bind pub o|o !start proc_iostart

proc proc_iostart {nick uhost hand chan args} {
	global binary announce
	putquick "PRIVMSG $chan :-\[START\] + Attempting to start ioFTPD"
	cd c:/FTP-SERVER/ioFTPD/system
	exec pslist ioFTPD > nul
	If 
		(ERRORLEVEL 1) {
			exec ioFTPD.exe 
			putquick "PRIVMSG $chan :-\[START\] + ioFTPD started"
	}
	Else	
		{
		putquick "PRIVMSG $chan :-\[START\] + ioFTPD already running"
	}
	cd c:/FTP-SERVER/sitebot/
}
I currently get an error stating if is an invalid command.
I was wanting to just run a bat file from here and it was working however it didn't exit correctly so froze the bot so I'm trying to insert it directly into the script.

Code:
@echo off
CD d:\path\to\ioFTPD\system
pslist ioFTPD > nul
IF ERRORLEVEL 1 GOTO restart
GOTO END

:RESTART
CD d:\path\to\ioFTPD\system
start ioFTPD.exe

:END
EwarWoo is offline