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 

Crontab problem

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


Joined: 02 May 2007
Posts: 44

PostPosted: Mon Feb 22, 2010 6:59 am    Post subject: Crontab problem Reply with quote

I canīt get the crontab to work i have did like this btw crontab is under eggdrop maindir and named to Dev.botchk

Code:

0,10,20,30,40,50 * * * * /home/mynick/eggdrop/Dev.botchk >/dev/null 2>&1


Code:

#! /bin/sh
#
# botchk
#
# $Id: botchk,v 1.6 2002-02-27 18:21:46 guppy Exp $
#
# This is a script suitable for use in a crontab.  It checks to make sure
# your bot is running.  YOU NEED A SEPARATE CRON JOB FOR EACH BOT.  If your
# bot isn't found, it'll try to start it back up.
#
# You'll need to edit this script for your bot.
#
# To check for your bot every 10 minutes, put the following line in your
# crontab:
#    0,10,20,30,40,50 * * * *   /home/mydir/mybot/botchk
# And if you don't want to get email from crontab when it checks you bot,
# put the following in your crontab:
#    0,10,20,30,40,50 * * * *   /home/mydir/mybot/botchk >/dev/null 2>&1
#

# change this to the directory you run your bot from (capitalization COUNTS):
botdir="/home/mynick/eggdrop"

# change this to the name of your bot's config file (capitalization COUNTS):
botscript="./Dev Dev.conf"

# change this to the botnet-nick of your bot (capitalization COUNTS):
botname="Dev"

# change this to the name of your bot's userfile (capitalization COUNTS):
userfile="Dev.user"

# change this to the name of your bot's pidfile (capitalization COUNTS):
pidfile="Dev.pid"

########## you probably don't need to change anything below here ##########

cd $botdir

# is there a pid file?
if test -r $pidfile
then
  # there is a pid file -- is it current?
  botpid=`cat $pidfile`
  if `kill -CHLD $botpid >/dev/null 2>&1`
  then
    # it's still going -- back out quietly
    exit 0
  fi
  echo ""
  echo "Stale $pidfile file, erasing..."
  rm -f $pidfile
fi

if test -r CANTSTART.$botname
then
  if test -r $userfile || test -r $userfile~new || test -r $userfile~bak
  then
    echo ""
    echo "Userfile found, removing check file 'CANTSTART.$botname'..."
    rm -f CANTSTART.$botname
  fi
fi

# test if we have run botchk previously and didn't find a userfile
if test ! -f CANTSTART.$botname
then
  echo ""
  echo "Couldn't find bot '$botname' running, reloading..."
  echo ""
  # check for userfile and reload bot if found
  if test -r $userfile
  then
    # It's there, load the bot
    ./$botscript
    exit 0
  else
    if test -r $userfile~new
    then
      # Bot f*@!ed up while saving the userfile last time.  Move it over.
      echo "Userfile missing.  Using last saved userfile..."
      mv -f $userfile~new $userfile
      ./$botscript
      exit 0
    else
      if test -r $userfile~bak
      then
        # Userfile is missing, use backup userfile.
        echo "Userfile missing.  Using backup userfile..."
        cp -f $userfile~bak $userfile
        ./$botscript
        exit 0
      else
        # Well, nothing to work with...
        echo "No userfile.  Could not reload the bot..."
        echo "no userfile" > CANTSTART.$botname
        exit 1
      fi
    fi
  fi
fi

exit 0


Anyone that knows what the problem is or see anything wrong in here?
Back to top
View user's profile Send private message
tsukeh
Voice


Joined: 20 Jan 2005
Posts: 31

PostPosted: Mon Feb 22, 2010 8:52 am    Post subject: Reply with quote

Code:

# change this to the name of your bot's config file (capitalization COUNTS):
botscript="./Dev Dev.conf"


I bet your config is "Dev.conf" and not "./Dev Dev.conf" ?

also make sure first line of your config points to "eggdrop" binary:
Code:

#! /home/mynick/eggdrop/eggdrop


Dev.botchk and Dev.conf needs to have correct permissions:

chmod u+x Dev.botchk
chmod u+x Dev.conf
Back to top
View user's profile Send private message
Slaktarn
Halfop


Joined: 02 May 2007
Posts: 44

PostPosted: Mon Feb 22, 2010 9:11 am    Post subject: Reply with quote

I did this 4 stuff you told me to do but it still dosent start
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Feb 22, 2010 5:00 pm    Post subject: Reply with quote

Editing the botchk file.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Slaktarn
Halfop


Joined: 02 May 2007
Posts: 44

PostPosted: Tue Feb 23, 2010 3:42 am    Post subject: Reply with quote

Sir_Fz wrote:
Editing the botchk file.


I have read it if i wuld understand it i wuld not ask here?
Back to top
View user's profile Send private message
tsukeh
Voice


Joined: 20 Jan 2005
Posts: 31

PostPosted: Tue Feb 23, 2010 12:53 pm    Post subject: Reply with quote

After killing your eggdrop (if it's running) try to start it like:

Code:

./Dev.conf


If eggdrop starts kill it and then try to run botchk manually:

Code:

./Dev.botchk


If eggdrop starts again, those configs should be ok.
Back to top
View user's profile Send private message
Slaktarn
Halfop


Joined: 02 May 2007
Posts: 44

PostPosted: Wed Feb 24, 2010 4:08 am    Post subject: Reply with quote

tsukeh wrote:
After killing your eggdrop (if it's running) try to start it like:

Code:

./Dev.conf


If eggdrop starts kill it and then try to run botchk manually:

Code:

./Dev.botchk


If eggdrop starts again, those configs should be ok.


Strange it says its in wrong dir but it isent. And the first option work

Code:

mynick@hades ~/eggdrop $ ./Dev Dev.botchk

Eggdrop v1.6.20+checkconflags (C) 1997 Robey Pointer (C) 2008 Eggheads
[09:21] --- Loading eggdrop v1.6.20+checkconflags (Wed Feb 24 2010)
[09:21] Tcl error in file 'Dev.botchk':
[09:21] invalid command name "botdir="/home/mynick/eggdrop""
    while executing
"botdir="/home/mynick/eggdrop""
    (file "Dev.botchk" line 22)
[09:21] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2829

PostPosted: Wed Feb 24, 2010 1:33 pm    Post subject: Reply with quote

slaktarn:
That error message is generated because you try to start your eggdrop using the botchk-script as a config-file. Not the way to do it...

Re-read tsukeh's post. First step is to see if your config-file is executable (and the #! magic number is set up properly).
If this works, run the botchk-script manually, as the bash-script it is, and track any and all errors thrown.

In neither of the above tests should you prefix the comand/file with the eggdrop binary.

As a final resort, drop the pipe-redirects from the cron-job, and you should recieve an email whenever the botchk-script is run and something happened. This should atleast provide some hints to what's setup incorrectly...
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Slaktarn
Halfop


Joined: 02 May 2007
Posts: 44

PostPosted: Thu Feb 25, 2010 6:46 am    Post subject: Reply with quote

nml375 wrote:
slaktarn:
That error message is generated because you try to start your eggdrop using the botchk-script as a config-file. Not the way to do it...

Re-read tsukeh's post. First step is to see if your config-file is executable (and the #! magic number is set up properly).
If this works, run the botchk-script manually, as the bash-script it is, and track any and all errors thrown.

In neither of the above tests should you prefix the comand/file with the eggdrop binary.

As a final resort, drop the pipe-redirects from the cron-job, and you should recieve an email whenever the botchk-script is run and something happened. This should atleast provide some hints to what's setup incorrectly...


Im relly sorry but donīt get a [censored] of any of what you ppl taking about i searched around a bit more and find out that you never shuld use a Windows editor to edit your files. Try to reedit the botchk file in vi editor and it seems to work fine. Now i just have a last question for you ppl. When it starts up it starts whit Dev.conf insted of Dev it it the way it shuld be it dosent matter relly just a thing i note.

Code:

botscript="Dev.conf"
changed to
botscript="./Dev Dev.conf"


That sloved the thing i wrote befor that my bot start whit Dev.conf know it starts whit the binary insted of the conf file.

Hoever i will thx everyone in this section that try to help me slove this!
Thx alot and the prob sloved i wuld prob figure all this out my self it i not was so stupid to edit all conf file in Windows. It was the real problem. Else its relly easy to set up botchk file. To anyone else that have problem whit it! Never edit in Windows use vi editor in linux

Mvh Slaktarn
Back to top
View user's profile Send private message
kameelperdza
Voice


Joined: 18 Oct 2010
Posts: 3

PostPosted: Tue Oct 19, 2010 10:34 am    Post subject: re Reply with quote

Hi i also have the problem that says invalid command name "botdir"

I have checked and double checked, i also tried to edit the botchk file with vim.

What else can i try?
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 -> Eggdrop 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