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.

How to keep a file deleted?

Help for those learning Tcl or writing their own scripts.
Post Reply
L
Landslyde
Halfop
Posts: 46
Joined: Thu May 01, 2014 6:01 pm

How to keep a file deleted?

Post by Landslyde »

Using an eggdrop 1.8, i run statistics.tcl.
I have a cron job scheduled to delete the entire folder that holds the statsicts text:

Code: Select all

* 14 * * * rm -rf /home/shianne/eggdrop/scripts/dbase
This works fine. But the thing is, the deleted folder with the stats file still comes right back, even thought it just got deleted. It doesn't get zeroed out. I have to manually shut down my bot, delete the folder, then start the bot again for the folder to stay deleted.

What am I missing here? What do I need to do? Thanks.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The bot doesn't create any folders on it's own, so the culprit is the statistics.tcl file you have loaded. You would have to look in there to see the part that recreates the file and comment is out (meaning put a # in front of the lines).
Once the game is over, the king and the pawn go back in the same box.
L
Landslyde
Halfop
Posts: 46
Joined: Thu May 01, 2014 6:01 pm

Post by Landslyde »

Hey caesar:

Thanks for your reply. I can't comment out that line due to the fact that the file I delete has to be instantly created again so the channel stats can be tracked.

So, here's what I guess I really need help with.

I delete that file using a cron job at 14:00 on the server. What has to happen next is I need to have the bot restart. I know what botchk is for and this isn't what I'm talking abt here. I need a file that I can execute with a cron job that will restart my bot at 14:01, one minute after the file's been deleted. I'll name the file restart.tcl, but I don't know what to put in it.

If I had this cron job set up:

Code: Select all

1 14 * * *  /home/shianne/eggdrop/scripts/restart.tcl
what wld I use to restart the bot with?

Thank you for your help.
Online
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Visit:
http://www.eggheads.org/support/egghtml ... mands.html

and text search for:
restart

It is in this section:
9. Miscellaneous commands

See if that reads like it is what you want.
I hope this helps.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
L
Landslyde
Halfop
Posts: 46
Joined: Thu May 01, 2014 6:01 pm

Post by Landslyde »

Hi guys:

I created the file restart.tcl and placed it in the scripts directory of the bot in question. In it I only had one command

Code: Select all

restart
My cron jobs are:

Code: Select all

* 13 * * * rm -rf /home/shianne/eggdrop/scripts/dbase
1 13 * * * /home/shianne/eggdrop/scripts/restart.tcl
While the database did get deleted, the bot never restarted. I had to go in and manually restart her again. I think I'm getting close though :-) What am I doing wrong?
Online
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Landslyde wrote:

Code: Select all

1 13 * * * /home/shianne/eggdrop/scripts/restart.tcl
crontab will try to run executable files. A typical example would be an executable bash script file.
That's not a bash script file. :)
Sorry ... I didn't focus well or something on my first response here, and mention this.

Remove that line from crontab.


So you need a way to run a tcl procedure, on a schedule - right?

Back to tcl-commands.doc
Text search for
bind cron
and read about that bind. Read the description carefully too.

Before you try to add that bind to your tcl script, it is a good idea to google for crontab examples and read up on how to set the schedule in them, as it is the same.

I hope this gets you going in the right direction.
Let us know.


p.s.
I don't know if you need help with TCL and binds and procs or not.
This helps a lot:
http://suninet.the-demon.de/index.htm
Easy to follow, and organized.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Put this code in restart.tcl in scripts folder of the bot then add it in eggdrop.conf then rehash the bot.

Code: Select all

bind cron - {1 13 * * *} restart:cron

proc restart:cron {min hour day month weekday} {
	restart
}
This will make the bot restart itself at the 13:01 time you wanted.
Once the game is over, the king and the pawn go back in the same box.
L
Landslyde
Halfop
Posts: 46
Joined: Thu May 01, 2014 6:01 pm

Post by Landslyde »

caesar:

Thank you. I was looking at this and was more confused than ever! Thank you for your help. Much appreciated.
Post Reply