[rancid] problem with rancid crontab

Vacheslav m_zouhairy at skno.by
Tue Oct 3 14:49:22 UTC 2017


~ # su –l “/tmp/test.sh” rancid

No passwd entry for user '–l'

 

From: Gauthier, Chris [mailto:cgauthier at comscore.com] 
Sent: Tuesday, October 3, 2017 5:44 PM
To: Vacheslav <m_zouhairy at skno.by>; 'Alexander Griesser' <AGriesser at anexia-it.com>; rancid-discuss at shrubbery.net
Subject: Re: [rancid] problem with rancid crontab

 

I fixed that by running:

 

su –l “/tmp/test.sh” rancid

 

The “-l” says to make it a login shell so the environment variables will load.

 

--Chris

 

 



Chris Gauthier

  

Senior Network Engineer

 | 

comScore, Inc.




o +1 

 <tel:503-331-2704> 503-331-2704

  

 <mailto:cgauthier at comscore.com> cgauthier at comscore.com


317 SW Alder St, Suite 500 | Portland | OR 97204



............................................................................................................................................................................................................................


	

 

From: Rancid-discuss <rancid-discuss-bounces at shrubbery.net <mailto:rancid-discuss-bounces at shrubbery.net> > on behalf of Vacheslav <m_zouhairy at skno.by <mailto:m_zouhairy at skno.by> >
Date: Tuesday, October 3, 2017 at 7:37 AM
To: 'Alexander Griesser' <AGriesser at anexia-it.com <mailto:AGriesser at anexia-it.com> >, "rancid-discuss at shrubbery.net <mailto:rancid-discuss at shrubbery.net> " <rancid-discuss at shrubbery.net <mailto:rancid-discuss at shrubbery.net> >
Subject: Re: [rancid] problem with rancid crontab

 

Well it didn’t run because when I su rancid and execute:
/root $ /tmp/test.sh

bash: /tmp/test.sh: /bin/sh^M: bad interpreter: No such file or directory

running: sh /tmp/test.sh

produces  a log file with the following content:

/root

How to fix the script?

 

From: Alexander Griesser [mailto:AGriesser at anexia-it.com] 
Sent: Tuesday, October 3, 2017 4:53 PM
To: Vacheslav <m_zouhairy at skno.by <mailto:m_zouhairy at skno.by> >; rancid-discuss at shrubbery.net <mailto:rancid-discuss at shrubbery.net> 
Subject: AW: [rancid] problem with rancid crontab

 

I’m not sure if your answer means that the problem is solved now or not; if it isn’t, please add the following testscript as a cronjob and check the output:

 

Create the file „/tmp/envtest.sh“ with the following content:

#!/bin/sh

export > /tmp/envtest.log

set >> /tmp/envtest.log

pwd >> /tmp/envtest.log

 

Save it and run `chmod 755 /tmp/envtest.sh`.

Add the following line to your crontab:

 

0                             * *   *   *                          rancid                   /tmp/envtest.sh

 

Wait a minute and check /tmp/envtest.log; you should see the environment and current working directory in the logfile then which might help to diagnose this issue.

 

Best,

 

 

Alexander Griesser

Head of Systems Operations

 

ANEXIA Internetdienstleistungs GmbH

 

E-Mail:  <mailto:AGriesser at anexia-it.com> AGriesser at anexia-it.com 

Web:  <http://www.anexia-it.com/> http://www.anexia-it.com 

 

Anschrift Hauptsitz Klagenfurt: Feldkirchnerstraße 140, 9020 Klagenfurt

Geschäftsführer: Alexander Windbichler

Firmenbuch: FN 289918a | Gerichtsstand: Klagenfurt | UID-Nummer: AT U63216601

 

Von: Vacheslav [mailto:m_zouhairy at skno.by] 
Gesendet: Dienstag, 3. Oktober 2017 15:45
An: Alexander Griesser <AGriesser at anexia-it.com <mailto:AGriesser at anexia-it.com> >; rancid-discuss at shrubbery.net <mailto:rancid-discuss at shrubbery.net> 
Betreff: RE: [rancid] problem with rancid crontab

 

Well if it were properly set, the error would be clear.
rancid:x:103:101:added by portage for rancid:/var/rancid:/bin/bash

Thanks for the answer.

 

From: Alexander Griesser [mailto:AGriesser at anexia-it.com] 
Sent: Tuesday, October 3, 2017 4:16 PM
To: Vacheslav <m_zouhairy at skno.by <mailto:m_zouhairy at skno.by> >; rancid-discuss at shrubbery.net <mailto:rancid-discuss at shrubbery.net> 
Subject: AW: [rancid] problem with rancid crontab

 

Hi,

 

You can set the CWD to ~rancid first and then execute „rancid-run“, but this is (at least to my experience) not necessary if the home directory for your rancid user iss et properly in /etc/passwd.

What does `grep rancid /etc/passwd` return on your system? Is /var/rancid liste das the home directory for this account?

 

Best,

 

Alexander Griesser

Head of Systems Operations

 

ANEXIA Internetdienstleistungs GmbH

 

E-Mail:  <mailto:AGriesser at anexia-it.com> AGriesser at anexia-it.com 

Web:  <http://www.anexia-it.com/> http://www.anexia-it.com 

 

Anschrift Hauptsitz Klagenfurt: Feldkirchnerstraße 140, 9020 Klagenfurt

Geschäftsführer: Alexander Windbichler

Firmenbuch: FN 289918a | Gerichtsstand: Klagenfurt | UID-Nummer: AT U63216601

 

Von: Rancid-discuss [mailto:rancid-discuss-bounces at shrubbery.net] Im Auftrag von Vacheslav
Gesendet: Dienstag, 3. Oktober 2017 14:23
An: rancid-discuss at shrubbery.net <mailto:rancid-discuss at shrubbery.net> 
Betreff: [rancid] problem with rancid crontab

 

 

Peace, 

I configured crontab as root as such:

0                             */6 *   *   *                          rancid                   /usr/bin/rancid-run

# Clean out config differ logs5

0                             23  *   *   *                           rancid                   /usr/bin/find /var/rancid/logs -type f -mtime +2 -exec rm {} \

 

But an error is logged:
clogin error: Error: password file (//.cloginrc) does not exist

I do not understand what the path // is. The .cloginrc file is in /var/rancid

Or is it absolutely necessary to run cron as user rancid? 
p.s I’m using rancid 3.7

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20171003/f46d9a31/attachment.html>


More information about the Rancid-discuss mailing list