egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to keep a file deleted?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Landslyde
Halfop


Joined: 01 May 2014
Posts: 46

PostPosted: Sun Aug 07, 2016 11:50 am    Post subject: How to keep a file deleted? Reply with quote

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:
* 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.
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Mon Aug 08, 2016 1:32 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Landslyde
Halfop


Joined: 01 May 2014
Posts: 46

PostPosted: Mon Aug 08, 2016 4:28 pm    Post subject: Reply with quote

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:
1 14 * * *  /home/shianne/eggdrop/scripts/restart.tcl


what wld I use to restart the bot with?

Thank you for your help.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Aug 08, 2016 4:36 pm    Post subject: Reply with quote

Visit:
http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.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 !
Back to top
View user's profile Send private message
Landslyde
Halfop


Joined: 01 May 2014
Posts: 46

PostPosted: Tue Aug 09, 2016 12:20 pm    Post subject: Reply with quote

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:
restart


My cron jobs are:

Code:
* 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 Smile What am I doing wrong?
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue Aug 09, 2016 12:50 pm    Post subject: Reply with quote

Landslyde wrote:

Code:

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. Smile
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 !
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Aug 10, 2016 2:41 am    Post subject: Reply with quote

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

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.
Back to top
View user's profile Send private message
Landslyde
Halfop


Joined: 01 May 2014
Posts: 46

PostPosted: Thu Aug 11, 2016 3:29 am    Post subject: Reply with quote

caesar:

Thank you. I was looking at this and was more confused than ever! Thank you for your help. Much appreciated.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber