This guide is as long and as comprehensive as it needs to be so that anyone is able to follow and understand how to set up crontab correctly after they've read this.
START----------
Essential things to remember (in my opinon):
1) Remember that CaPiTaLiSaTiOn on LiNuX counts, if you try to access a file or directory for example, by typing a few letters of its title into the shell window and hitting tab to auto-complete the rest of the file or directory's title, it will not work if you started the first letter of the title with a lower case letter if the actual file or directory starts with an UPPER CASE letter and visa versa.
2) Remember that when a slash is missing off the very end of a path, it means that the text on the very end is a file. if there IS a slash at the very end of said path then that text at the very end of that path is a directory/folder.
3) Also remember about the 'c<hange>d<directory>' command. You would 'cd' to your bot's folder when you want to execute it with 'eggdrop eggdrop *.conf' which launches your bot into the background. for example, you want to start your bot from the shell window but it won't work 'cause you tried to run your bot from the wrong location - How to fix? Lets say that you're in the path of 'yourusername' directory and that your bot is called 'LamestBot', and is in a folder of the same name (which holds all your eggdrop files, .conf,scripts,etc.), and that, that folder is located in 'yourusername' directory - you would type 'cd LamestBot' (or 'cd lame + TAB' to auto-complete the rest of the name), to change the path from '/home/yourusername/' to '/home/yourusername/LamestBot/, now you're in the correct directory and the problem is fixed, then you would type 'eggdrop eggdrop *.conf' to launch your bot.
4) Remember to type 'ps x' into your shell window when you want to see what processes/tasks you have runnning in the background.
5) Remember when you want to kill your bot, you can kill it in the following ways: by typing '.die' into the telnet version of the bot's party line - by typing '.die' into the ctcp version of the bot's partyline - by having and using a script that sends the bot the 'die' command either by an in-channel trigger, a notice or a private message to the bot, or even in a memo in some instances - and by using either 'pkill eggdrop' or 'kill all eggdrop' + many other kill variations in your Linux shell terminal.
6) Remember 'pwd' (print working directory) will show the current path you're in on your linux shell window/terminal session.
7) (very important) Remember that you must have the 'eggdrop binary executable' and the 'botchk' file in your eggdrop bot's main directory; where your 'eggdrop *.conf' is located. e.g. these would be the paths of those two files once you copied them to the correct location: 'eggdrop binary executable' path: /home/yourusername/yourbot'sfoldername/eggdrop - and the 'botchk' path: /home/yourusername/yourbot'sfoldername/botchk - you can find the 'eggdrop binary executable' when you compile your bot on a Linux system (if using a windrop like I am <technically a hybrid version but whatever> just copy the 'eggdrop binary executable' from where-ever you get it from into the above path, making sure it was compiled for the same version of eggdrop you're using) - you can find the botchk file in your bot's 'scripts' folder (/home/yourusername/yourbot'sfoldername/scripts/.
8) I cannot stress this enough - when you see 'eggdrop eggdrop *.conf' it means if you've called your bot's config file something else then you'd start your bot like this: eggdrop THEDIFFERENTNAMEYOUGAVEYOURCONFIG.conf, otherwise just 'eggdrop eggdrop.conf'
DONE----------
START~~~~~~~~~~~~~~~
Guide starts here:
1) Edit the first line of your eggdrop.conf from this:
#! /path/to/executable/eggdrop - into this for e.g.
#!/home/sane/Bollox/eggdrop - 'sane' replaced by your username, 'Bollox' replaced by the name of your bot's folder.
2) Make sure you have the 'botchk' and the 'eggdrop binary executable' files in your bot's main directory; where your 'eggdrop *.conf' is located. The 'eggdrop *.conf' that you just changed the first line of to look like this: #!/home/yourusername/yourbot'sfoldername/eggdrop.
3) Okay now, make sure you're in the correct path in your shell window, and that you stay in that correct path throughout this whole crontab process: '/home/yourusername/yourbot'sfoldername/', now you're going to want to type these two commands one at a time into the shell window: 'chmod u+x eggdrop' and 'chmod u+x botchk' - or chmod 700, stick with u+x though, which is equivalent to 744. These commands will grant only the owner of those files I.E YOU execution permissions, that's what the 'u' stands for, 'you', and what the 'x' stands for is.. 'executable'. You'll know that this worked if you type 'ls' into the shell window and you see that those two files that you chmoded are now coloured in green text.
4) Next edit the 'botchk' file by typing 'pico botchk' into the shell window, edit it so there's no " ./ " (dot slash) in it at all. (total of 3) (just backspace the " ./ " <dot slashes> out) (e.g. " ./$botscript " - backspace the slash and dot out so it's just '$botscript') (control + w in pico is equivalent to control + f<ind> on Windows)
5) While still in 'pico' edit the coloured info in the 'botchk file', edit the default coloured text to look exactly like the following table below. Note: This info in brackets applies to the below table in code -->(REMEMBER TO MAKE SURE THERE'S A SLASH AT THE BEGINNING OF 'home', so '/home' - VERY IMPORTANT, AND MAKE SURE THERE'S A SLASH AFTER 'yourbot'sfoldername', so 'yourbot'sfoldername/' - VERY IMPORTANT, so it should look like this: '/home/yourusername/yourbot'sfoldername/') (ALSO, NO ./ <DOT SLASH> INFRONT OF " eggdrop eggdrop *.conf " - VERY IMPORTANT)
-6)-
Code: Select all
Table:
# change this to the directory you run your bot from (capitalization COUNTS):
botdir="/home/yourusername/yourbot'sfoldername/"
# change this to the name of your bot's config file (capitalization COUNTS):
botscript="eggdrop eggdrop *.conf"
# change this to the botnet-nick of your bot (capitalization COUNTS):
botname="yourbot'snick"
# change this to the name of your bot's userfile (capitalization COUNTS):
userfile="yourbot'snick.user"
# change this to the name of your bot's pidfile (capitalization COUNTS):
pidfile="pid.yourbot'snick"
########## you probably don't need to change anything below here ##########
8) Next type 'pico crones' into the shell window, this will open up the current crones file for editing or create a new crones file if there isn't one there - "there" being the path directory you were in when you executed the command - so '/home/yourusername/yourbot'sfoldername/'
9) Now paste following after the colon into the crones file:
0,10,20,30,40,50 * * * * /home/yourusername/yourbot'sfoldername/botchk >/dev/null 2>&1
10) Then hit control + o to save, then hit Enter to keep the same file name of 'crones', then hit control + x to exit out of pico.
11) Next you're going to want to delete any crontabs you already have stored by typing 'crontab -r'(sometimes -d) into the shell window; which will delete all crontabs stored. (Not essential, but I'd reccomend doing it)
12) Next type 'crontab crones' into the shell window, this will add the line you copied into the 'crones' file into a new crontab, then type 'crontab -l' to list all crontabs, the crontab you just added should appear on a new line and should be the only crontab you see there.
13) After all that you're going to want to type the following into the shell window: './botchk eggdrop *.conf' (./botchk THEDIFFERENTNAMEYOUGAVEYOURCONFIG.conf, otherwise just './botchk eggdrop.conf')
14) It should work now, your bot should launch normally, just like if you're using 'eggdrop eggdrop *.conf'
15) Next try: './botchk eggdrop *.conf' again (while your eggdrop is already running, check with 'ps x' to make sure it is; check IRC too), nothing should happen and you should see nothing happen in the shell window, the next thing to do is to kill the bot and just wait and see if crontab starts the bot by itself, if the bot does start then crontab sucessfully started botchk which sucessfully started the bot by itself.
END~~~~~~~~~~~~~~~
..........
Protip: check the dead.letter file that will inevitably be created in the '/home/yourusername/' directory, and by check I mean 'pico dead.letter' (control + x to exit pico), this file (in this case, my dead.letter) should show you something like this:
sane@*irrelevant*:~$ pico dead.letter
GNU nano 2.2.2 File: dead.letter
Couldn't find bot 'Bollox' running, reloading...
[19:20] --- Loading eggdrop v1.6.19+SSL (*date irrelevant*)
[19:20] Listening at telnet port *irrelvant* (*irrelvant*).
[19:20] Module loaded: blowfish
[19:20] Module loaded: dns
[19:20] Module loaded: channels
[19:20] Module loaded: server
[19:20] Module loaded: ctcp
[19:20] Module loaded: irc
[19:20] Module loaded: notes (with lang support)
[19:20] Module loaded: console (with lang support)
[19:20] Module loaded: seen
[19:20] Module loaded: uptime
[19:20] MegaHAL v3.5 by ^Baron^ loaded.
[19:20] Module loaded: megahal
[19:20] ^C0,1 ^CLoaded: Ident
[19:20] ^C0,1 ^CLoaded: ^C0,1^B BaOSS ^B^C
[19:20] ^C0,1 ^CLoaded ^B^C0,1TV^C4,1rage^B^C
[19:20] ^C0,1 ^CLoaded: R4Nd
[19:20] ^C1,1 ^CLoaded: ^C9,1^B WIN ^C0,4 FAIL ^C
[19:20] ^C0,1 ^CLoaded: ^C1,15Dice
[19:20] % youtube_title0.5: loaded
[19:20] peak1.8.tcl by FireEgl@EFNet <EggTCL@FireEgl.CJB.Net> - Loaded.
[19:20] troll.tcl v2.0 by spithash@DALnet iz up and trollin'
[19:20] - incith:google-1.8.8g loaded.
[19:20] google.tcl 0.31 loaded
[19:20] beer.tcl v.1.beta1 by SpiKe^^ loaded
[19:20] - UNOFFICIAL incith:google-2.0.0b loaded.
[19:20] IMDB info version 19.10.2010 loaded
[19:20] youtube getlink v 0.1 by hwk loaded
[19:20] Urban.tcl 2.0 by Trixar_za Loaded
[19:20] ^C04Modern Roulette Made By Dopeydwerg Loaded
[19:20] Loaded RemoveBans (DLF)
[19:20] - ^BSex Dice^B version 1.0a loaded.
[19:20] Insult.tcl v1.02 by David Proper (DrN) -: LoadeD :-
[19:20] ^C0,1 ^CLoaded: ^C8,4^B MOAR
[19:20] ^C0,1 ^CLoaded: ^C13,1^B NAOW
[19:20] ^C0,1 ^CLoaded:^B^C4,1 KUTGW. :)
[19:20] Url Title Grabber 0.01a (rosc) script loaded..
[19:20] incith:horoscope-3.2: loaded.
[19:20] ^B*Loaded* ^B^C01,11-FML-^B^C ^BRandom by Ford_Lawnmower irc.GeekShed.net #Script-Help
[19:20] * easyspeak-Me_Only.tcl by Dalanx loaded.
[19:20] ^C4KnK Script v1.0 by Ian Preglo and Marluo Anuengo has been loaded.^C
[19:20] bMotion 0.1.0 starting up...
[19:20] loaded fact module
[19:20] bMotion: new installation, need to send stats/check version...
[19:20] bMotion: diagnostics indicate you haven't loaded the userinfo TCL script
[19:20] this is not required, but is strongly recommended
[19:20] ^BbMotion 0.1.0 AI online^B :D
[19:20] bMotion is Copyright (C) 2007 James Seward. bMotion comes with ABSOLUTELY NO WARRANTY;
[19:20] This is free software, and you are welcome to redistribute it under certain conditions.
[19:20] See the COPYRIGHT file for details. See bMotion.tcl to hide this message once you have read it.
[19:20] Loaded STFU Script - By Sane (irc://irc.rizon.net/kl-channel)
[19:20] Weatherscript from Djoezy loaded - version v1.1
[19:20] Public whois script 0.10 by MeTroiD, #v1per on Quakenet
[19:20] ^B*Wicked Flame script LOADED v0.1 by jastarafi*
[19:20] Brain learning mode set to on
[19:20] YouTube 1.3 loaded
[19:20] Loading dccwhois.tcl...
[19:20] Loaded dccwhois.tcl
[19:20] Identd: I don't know why you're using winident.tcl on your system, but it probably won't work on anything but Windows.
[19:20] winident.tcl v1.2 - by FireEgl@EFNet <FireEgl@Windrop.cjb.net> - Loaded.
[19:20] Userfile loaded, unpacking...
[19:20] === Bollox: 3 channels, 1 users.
Eggdrop v1.6.19+SSL (C) 1997 Robey Pointer (C) 2008 Eggheads
Eggdrop v1.6.19+SSL (C) 1997 Robey Pointer (C) 2008 Eggheads
Launched into the background (pid: *****)
..........
**********
The above contents of the 'dead.letter' file clearly shows that once your crontab (in this case mine) started your botchk file, the botchk file saw that your bot wasn't running at the moment/point in time that it checked, so the botchk file automatically did the equivalent of what you would do to load your bot yourself, and that is: 'eggdrop eggdrop *.conf' as specified in the botchk file when you were editing it, remember?
**********
Guide completely written by me, Sane, using my own words and researched info from a vast array of sources, but mainly my own initiative and lots of trial and error. NOTE: this crontab will start botchk every 10 minutes, which will then check if your bot is still running every 10 minutes. If when it checks, it finds your bot's already running then it will do nothing.
I don't wish for this guide to be copied anywhere else without my consent.