Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Sep 2009 17:31:45 +0200
From:      Mel Flynn <mel.flynn+fbsd.questions@mailing.thruhere.net>
To:        freebsd-questions@freebsd.org
Cc:        stan <stanb@panix.com>
Subject:   Re: What invokes cricket on FreeBSD
Message-ID:  <200909031731.45563.mel.flynn%2Bfbsd.questions@mailing.thruhere.net>
In-Reply-To: <20090903144228.GA5919@teddy.fas.com>
References:  <20090903114857.GA635@teddy.fas.com> <200909031622.43318.mel.flynn%2Bfbsd.questions@mailing.thruhere.net> <20090903144228.GA5919@teddy.fas.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 03 September 2009 16:42:28 stan wrote:
> On Thu, Sep 03, 2009 at 04:22:43PM +0200, Mel Flynn wrote:
> > On Thursday 03 September 2009 15:41:07 stan wrote:
> > > On Thu, Sep 03, 2009 at 09:33:35AM -0400, stan wrote:
> > > > On Thu, Sep 03, 2009 at 09:22:56AM -0400, stan wrote:
> > > > > On Thu, Sep 03, 2009 at 01:43:15PM +0100, Matthew Seaman wrote:
> > > > > > stan wrote:
> > > > > > > On Thu, Sep 03, 2009 at 07:48:57AM -0400, stan wrote:
> > > > > > >> I have inherited a system that uses Cricket on FreeBSD to do
> > > > > > >> some data collection. I have set this up myself in the distnat
> > > > > > >> past, but this time I asked a contractor to set it up. I no
> > > > > > >> longer have access to this contractor, and the toher day, we
> > > > > > >> shut down the system this was running on, and when we rebooted
> > > > > > >> the system, cricket id not resume collecting data.
> > > > > > >>
> > > > > > >> I don't see anyhting in /usr/local/etc/rc.d to start it up,
> > > > > > >> nor do I see anything in /etc/crontag. I don't seen any
> > > > > > >> processes owned by cricket running.
> > > > > > >>
> > > > > > >> In FreeBSD, how is this process noramally invoked?
> > > > > > >
> > > > > > > Sorry to reply to my own message, but I have more data. I did
> > > > > > > find
> > > > > > >
> > > > > > > -rw-------  1 root  wheel  288 Jan 12  2009
> > > > > > > /var/cron/tabs/cricke
> > > > > > >
> > > > > > > Which is, I am failry certain, what is _intended_ to invoke the
> > > > > > > cricket process. However, acording to the cricket logs, the
> > > > > > > last time I have an entry is Aug 29th, which was when the
> > > > > > > machine was shut down. So, I decided to try running this
> > > > > > > command by hand. Now, to do so I need to be the cricket user,
> > > > > > > so I tried to su - cricket. I was told that this user was not
> > > > > > > avaialble. Looking in /etc/passwd. I found that this users
> > > > > > > shell was listed as /usr/sbin/nologin. I edited /etc/paswd to
> > > > > > > change this to /nin/sh, but I still get the smae error message
> > > > > > > when I try to su to that user.
> > > > > > >
> > > > > > > What do I need to change to be able to su to this suer, and
> > > > > > > might this be the reason tha it's crontab entry is notbeing
> > > > > > > run?
> > > > > >
> > > > > > Try:
> > > > > >
> > > > > >    # su -m cricket
> > > > > >
> > > > > > although the best way to examine and/or modify that user's
> > > > > > crontab is:
> > > > > >
> > > > > >    # crontab -e -u cricket
> > > > >
> > > > > OK, I was able to execute the cricket collector caoomand bu using
> > > > > the su - format, and it ran corectly.
> > > > >
> > > > > Cany anyone sugest what to check to see why cron is not executing
> > > > > this command? I see no evidence of it's running in either the
> > > > > cricket logs' or cron's logs.
> > > > >
> > > > > Thanks.
> > > >
> > > > Repkying to my own message again :-(
> > > >
> > > >
> > > > OK, I found in the cron man page the following:
> > > >
> > > >  Before running a command from a per-account crontab file, cron
> > > >  checks the status of the account with pam(3) and skips the command
> > > > if the account is unavailable, e.g., locked out or expired.
> > > >
> > > > So, now the question is, how do I unlock that user?
> > >
> > > This gets strnager. I found the pw cammand, which should do thatm but:
> > >
> > > pnoc# pw unlock cricket
> > > pw: user 'cricket' is not locked
> > >
> > > So, how come:
> > >
> > > pnoc# su - cricket
> > > This account is currently not available.
> >
> > Cause cricket doesn't have a valid home directory. However, you can
> > simply copy the /var/cron/tabs/cricket to /tmp. Remove the time colums,
> > then run: su -m cricket /usr/bin/env -i HOME=/nonexistent
> > PATH=/bin:/usr/bin \ /bin/sh /tmp/cricket
> >
> > That's the best approximation of how cron runs the commands. If you don't
> > see anything in the cron logs however, it may be an issue with the
> > timestamps specified not yielding any runs. Then it would help to see the
> > actual crontab file.
>
> Hmm, but I think it does :
>
> pnoc# grep cricket /etc/passwd
> cricket:*:141:80:Cricket Monitoring
> User:/usr/local/cricket:/usr/sbin/nologin

/usr/sbin/nologin. I guess you edited master.passwd and didn't use the proper 
tools (vipw or run pwd_mkdb after using a plain editor).


> As far as cron logs, I am _now_ gettting an entry that looks like cron is
> executing the collector:
>
> Sep  3 10:40:00 pnoc /usr/sbin/cron[80979]: (cricket) CMD
> (/usr/local/cricket/cricket/collect-subtrees normal)
>
> But, still not getting anything in cricket's logs:
>
> ls: No match.
> pnoc# ls -l /usr/local/cricket/*logs
> total 2812
> -rw-r--r--  1 cricket  www   74098 Sep  3 09:17 normal.0
>
> The 9:17 time is from a manual run of the collector.
>
> I must admit, I am not certain waht to check next.

Run:
su -m cricket /usr/bin/env -i HOME=/usr/local/cricket PATH=/bin:/usr/bin 
/usr/local/cricket/cricket/collect-subtrees normal

Then check output.
-- 
Mel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909031731.45563.mel.flynn%2Bfbsd.questions>