Go Back   FlashFXP Forums > >

Programming Need help with C/C++/Delphi? Ask here and make us all laugh.

Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 12-07-2005, 10:11 PM   #1
EwarWoo
Senior Member
FlashFXP Registered User
ioFTPD Registered User
 
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  
Old 12-13-2005, 10:04 PM   #2
R2_2k
Junior Member
 
Join Date: Aug 2003
Posts: 13
Default

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) {
#### TCL IFS USE :: IF { } { } format no ()'s
#if {$errorlevel??? == 1} or if {$errorlevel}

 
			exec ioFTPD.exe 
			putquick "PRIVMSG $chan :-\[START\] + ioFTPD started"
	}
	Else	
		{
		putquick "PRIVMSG $chan :-\[START\] + ioFTPD already running"
	}
	cd c:/FTP-SERVER/sitebot/
}
what does ps list return?
probably should be more like set ps [exec pslist ioFTPD> nul(null?)]
R2_2k is offline  
Old 12-14-2005, 05:44 AM   #3
EwarWoo
Senior Member
FlashFXP Registered User
ioFTPD Registered User
 
Join Date: Oct 2002
Posts: 462
Default

I now have:
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
	set ps [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-SEVER/sitebot/
}

putlog "ioStart \[Loaded\]"
and still getting if is an invalid command :/

Think I'll leave the coding to you guys who know what you're doing. Hehe

Cheers for the help anyways bud, appreciated.
EwarWoo is offline  
Old 12-14-2005, 08:45 AM   #4
R2_2k
Junior Member
 
Join Date: Aug 2003
Posts: 13
Default

Quote:
Originally Posted by EwarWoo
I now have:
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
	set ps [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-SEVER/sitebot/
}

putlog "ioStart \[Loaded\]"
and still getting if is an invalid command :/

Think I'll leave the coding to you guys who know what you're doing. Hehe

Cheers for the help anyways bud, appreciated.

Okay Well try if else (tcl == case sensitive) so make all (unless otherwise known) cmds lowercase
R2_2k is offline  
Old 12-14-2005, 11:13 AM   #5
R2_2k
Junior Member
 
Join Date: Aug 2003
Posts: 13
Default

Code:
bind pub o|o !start proc_iostart

set ios(dir) "c:/FTP-SERVER/ioFTPD/system"

proc proc_iostart {nick uhost hand chan args} {
	global  ios
       ### i do not see bin or ano used here so i removed them from global
	putquick "PRIVMSG $chan :-\[START\] + Attempting to start ioFTPD"

	#	cd c:/FTP-SERVER/ioFTPD/system
	### Replaced with $ios(dir)\executable
	set ps [exec $ios(dir)\pslist ioFTPD > nul]
	  if {$errorInfo == 1} {
	# no idea what errorlevel is; assuming its errorInfo
	## if you paste back what pslist ioFTPD returns could make that alot better   				#statement -i need too install io :P
		        exec $ios(dir)\ioFTPD.exe
			putquick "PRIVMSG $chan :-\[START\] + ioFTPD started"
	}
	else {
		putquick "PRIVMSG $chan :-\[START\] + ioFTPD already running"
	}

#	cd c:/FTP-SEVER/sitebot/
}

putlog "ioStart \[Loaded\]"
Yup so i tried too msg you on ole efnet but seems your afk for last +1days you still prowl around those parts?
R2_2k is offline  
Old 12-14-2005, 09:45 PM   #6
EwarWoo
Senior Member
FlashFXP Registered User
ioFTPD Registered User
 
Join Date: Oct 2002
Posts: 462
Default

I think I still have a script uidling on there but I rarely check it, dont get much chance to sit at computer when home anymore, too busy.
I'll have a look when I get in tonight, see if you're around, and let ya know if this works.

Cheers
EwarWoo is offline  
Old 12-17-2005, 07:17 PM   #7
EwarWoo
Senior Member
FlashFXP Registered User
ioFTPD Registered User
 
Join Date: Oct 2002
Posts: 462
Default

I gave up on it, I have this running every 10 mins via wincron instead:

Code:
 @echo off
CD c:\ftp-server\ioFTPD\system
pslist ioFTPD > nul
IF ERRORLEVEL 1 GOTO restart
GOTO RUNNING

:RESTART
echo ioFTPD not running, restarting >> c:\FTP-SERVER\ioFTPD\logs\ioRunning.log
echo |time |find "current" >> c:\FTP-SERVER\ioFTPD\logs\ioRunning.log
start ioFTPD.exe
GOTO END

:RUNNING
echo ioFTPD already running >> c:\FTP-SERVER\ioFTPD\logs\ioRunning.log
echo |time |find "current" >> c:\FTP-SERVER\ioFTPD\logs\ioRunning.log

:END
Ugly but works
EwarWoo is offline  
Closed Thread

Tags
ioftpd, putquick, restart, start, [start]

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 03:10 AM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)