Discussion:
[rancid] problem with rancid crontab
Vacheslav
2017-10-03 12:22:43 UTC
Permalink
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
Alexander Griesser
2017-10-03 13:16:19 UTC
Permalink
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: ***@anexia-it.com<mailto:***@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-***@shrubbery.net] Im Auftrag von Vacheslav
Gesendet: Dienstag, 3. Oktober 2017 14:23
An: rancid-***@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
Vacheslav
2017-10-03 13:44:54 UTC
Permalink
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:***@anexia-it.com]
Sent: Tuesday, October 3, 2017 4:16 PM
To: Vacheslav <***@skno.by>; rancid-***@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:***@anexia-it.com> ***@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-***@shrubbery.net] Im Auftrag
von Vacheslav
Gesendet: Dienstag, 3. Oktober 2017 14:23
An: rancid-***@shrubbery.net <mailto:rancid-***@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
Alexander Griesser
2017-10-03 13:52:48 UTC
Permalink
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: ***@anexia-it.com<mailto:***@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:***@skno.by]
Gesendet: Dienstag, 3. Oktober 2017 15:45
An: Alexander Griesser <***@anexia-it.com>; rancid-***@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:***@anexia-it.com]
Sent: Tuesday, October 3, 2017 4:16 PM
To: Vacheslav <***@skno.by<mailto:***@skno.by>>; rancid-***@shrubbery.net<mailto:rancid-***@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: ***@anexia-it.com<mailto:***@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-***@shrubbery.net] Im Auftrag von Vacheslav
Gesendet: Dienstag, 3. Oktober 2017 14:23
An: rancid-***@shrubbery.net<mailto:rancid-***@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
Vacheslav
2017-10-03 14:37:12 UTC
Permalink
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:***@anexia-it.com]
Sent: Tuesday, October 3, 2017 4:53 PM
To: Vacheslav <***@skno.by>; rancid-***@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:***@anexia-it.com> ***@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:***@skno.by]
Gesendet: Dienstag, 3. Oktober 2017 15:45
An: Alexander Griesser <***@anexia-it.com
<mailto:***@anexia-it.com> >; rancid-***@shrubbery.net
<mailto:rancid-***@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:***@anexia-it.com]
Sent: Tuesday, October 3, 2017 4:16 PM
To: Vacheslav <***@skno.by <mailto:***@skno.by> >;
rancid-***@shrubbery.net <mailto:rancid-***@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:***@anexia-it.com> ***@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-***@shrubbery.net] Im Auftrag
von Vacheslav
Gesendet: Dienstag, 3. Oktober 2017 14:23
An: rancid-***@shrubbery.net <mailto:rancid-***@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
Gauthier, Chris
2017-10-03 14:43:55 UTC
Permalink
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 GauthierSenior Network Engineer | comScore, Inc.
o +1 503-331-***@comscore.com
317 SW Alder St, Suite 500 | Portland | OR97204
............................................................................................................................................................................................................................

From: Rancid-discuss <rancid-discuss-***@shrubbery.net> on behalf of Vacheslav <***@skno.by>
Date: Tuesday, October 3, 2017 at 7:37 AM
To: 'Alexander Griesser' <***@anexia-it.com>, "rancid-***@shrubbery.net" <rancid-***@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:***@anexia-it.com]
Sent: Tuesday, October 3, 2017 4:53 PM
To: Vacheslav <***@skno.by>; rancid-***@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: ***@anexia-it.com<mailto:***@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:***@skno.by]
Gesendet: Dienstag, 3. Oktober 2017 15:45
An: Alexander Griesser <***@anexia-it.com<mailto:***@anexia-it.com>>; rancid-***@shrubbery.net<mailto:rancid-***@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:***@anexia-it.com]
Sent: Tuesday, October 3, 2017 4:16 PM
To: Vacheslav <***@skno.by<mailto:***@skno.by>>; rancid-***@shrubbery.net<mailto:rancid-***@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: ***@anexia-it.com<mailto:***@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-***@shrubbery.net] Im Auftrag von Vacheslav
Gesendet: Dienstag, 3. Oktober 2017 14:23
An: rancid-***@shrubbery.net<mailto:rancid-***@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
Vacheslav
2017-10-03 14:49:22 UTC
Permalink
~ # su –l “/tmp/test.sh” rancid

No passwd entry for user '–l'



From: Gauthier, Chris [mailto:***@comscore.com]
Sent: Tuesday, October 3, 2017 5:44 PM
To: Vacheslav <***@skno.by>; 'Alexander Griesser' <***@anexia-it.com>; rancid-***@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:***@comscore.com> ***@comscore.com


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



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






From: Rancid-discuss <rancid-discuss-***@shrubbery.net <mailto:rancid-discuss-***@shrubbery.net> > on behalf of Vacheslav <***@skno.by <mailto:***@skno.by> >
Date: Tuesday, October 3, 2017 at 7:37 AM
To: 'Alexander Griesser' <***@anexia-it.com <mailto:***@anexia-it.com> >, "rancid-***@shrubbery.net <mailto:rancid-***@shrubbery.net> " <rancid-***@shrubbery.net <mailto:rancid-***@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:***@anexia-it.com]
Sent: Tuesday, October 3, 2017 4:53 PM
To: Vacheslav <***@skno.by <mailto:***@skno.by> >; rancid-***@shrubbery.net <mailto:rancid-***@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:***@anexia-it.com> ***@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:***@skno.by]
Gesendet: Dienstag, 3. Oktober 2017 15:45
An: Alexander Griesser <***@anexia-it.com <mailto:***@anexia-it.com> >; rancid-***@shrubbery.net <mailto:rancid-***@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:***@anexia-it.com]
Sent: Tuesday, October 3, 2017 4:16 PM
To: Vacheslav <***@skno.by <mailto:***@skno.by> >; rancid-***@shrubbery.net <mailto:rancid-***@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:***@anexia-it.com> ***@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-***@shrubbery.net] Im Auftrag von Vacheslav
Gesendet: Dienstag, 3. Oktober 2017 14:23
An: rancid-***@shrubbery.net <mailto:rancid-***@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
Gauthier, Chris
2017-10-03 17:21:21 UTC
Permalink
Sorry, forgot the –c. I’m running clogin for some diagnostic stuff, but the same principle applies:

su -l -c "clogin -x stackstate-error-cmds.txt ${device}" rancid

--Chris


Chris GauthierSenior Network Engineer | comScore, Inc.
o +1 503-331-***@comscore.com
317 SW Alder St, Suite 500 | Portland | OR97204
............................................................................................................................................................................................................................

From: Vacheslav <***@skno.by>
Date: Tuesday, October 3, 2017 at 7:49 AM
To: "Gauthier, Chris" <***@comscore.com>, 'Alexander Griesser' <***@anexia-it.com>, "rancid-***@shrubbery.net" <rancid-***@shrubbery.net>
Subject: RE: [rancid] problem with rancid crontab

~ # su –l “/tmp/test.sh” rancid
No passwd entry for user '–l'

From: Gauthier, Chris [mailto:***@comscore.com]
Sent: Tuesday, October 3, 2017 5:44 PM
To: Vacheslav <***@skno.by>; 'Alexander Griesser' <***@anexia-it.com>; rancid-***@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

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



***@comscore.com<mailto:***@comscore.com>


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


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





From: Rancid-discuss <rancid-discuss-***@shrubbery.net<mailto:rancid-discuss-***@shrubbery.net>> on behalf of Vacheslav <***@skno.by<mailto:***@skno.by>>
Date: Tuesday, October 3, 2017 at 7:37 AM
To: 'Alexander Griesser' <***@anexia-it.com<mailto:***@anexia-it.com>>, "rancid-***@shrubbery.net<mailto:rancid-***@shrubbery.net>" <rancid-***@shrubbery.net<mailto:rancid-***@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:***@anexia-it.com]
Sent: Tuesday, October 3, 2017 4:53 PM
To: Vacheslav <***@skno.by<mailto:***@skno.by>>; rancid-***@shrubbery.net<mailto:rancid-***@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: ***@anexia-it.com<mailto:***@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:***@skno.by]
Gesendet: Dienstag, 3. Oktober 2017 15:45
An: Alexander Griesser <***@anexia-it.com<mailto:***@anexia-it.com>>; rancid-***@shrubbery.net<mailto:rancid-***@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:***@anexia-it.com]
Sent: Tuesday, October 3, 2017 4:16 PM
To: Vacheslav <***@skno.by<mailto:***@skno.by>>; rancid-***@shrubbery.net<mailto:rancid-***@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: ***@anexia-it.com<mailto:***@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-***@shrubbery.net] Im Auftrag von Vacheslav
Gesendet: Dienstag, 3. Oktober 2017 14:23
An: rancid-***@shrubbery.net<mailto:rancid-***@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
Alex DEKKER
2017-10-03 14:52:30 UTC
Permalink
Post by Vacheslav
/root $ /tmp/test.sh
bash: /tmp/test.sh: /bin/sh^M: bad interpreter: No such file or directory
running: sh /tmp/test.sh
/root
How to fix the script?
If there really is a ^M on the first line of the script then that
suggests it was created with "DOS" line endings. What are you using to
edit files? I can imagine that unexpected DOS line endings will cause
the various components of RANCID to fail in unexpected ways.

alexd
Vacheslav
2017-10-03 14:58:50 UTC
Permalink
Good observation, I was creating it using winscp, now I nanoed it and the
log file produced:
export HOME="/"

export LANG="en_US.utf8"

export LOGNAME="rancid"

export MAILTO="root"

export OLDPWD

export PATH="/sbin:/bin:/usr/sbin:/usr/bin"

export PWD="/"

export SHELL="/bin/bash"

export SHLVL="2"

export USER="rancid"

export _="/tmp/test2.sh"

BASH=/bin/sh

BASHOPTS=cmdhist:complete_fullquote:extquote:force_fignore:hostcomplete:inte
ractive_comments:progcomp:promptvars:sourcepath

BASH_ALIASES=()

BASH_ARGC=()

BASH_ARGV=()

BASH_CMDS=()

BASH_LINENO=([0]="0")

BASH_SOURCE=([0]="/tmp/test2.sh")

BASH_VERSINFO=([0]="4" [1]="3" [2]="48" [3]="1" [4]="release"
[5]="x86_64-pc-linux-gnu")

BASH_VERSION='4.3.48(1)-release'

DIRSTACK=()

EUID=103

GROUPS=()

HOME=/

HOSTNAME=nagios

HOSTTYPE=x86_64

IFS='

'

LANG=en_US.utf8

LOGNAME=rancid

MACHTYPE=x86_64-pc-linux-gnu

MAILTO=root

OPTERR=1

OPTIND=1

OSTYPE=linux-gnu

PATH=/sbin:/bin:/usr/sbin:/usr/bin

PIPESTATUS=([0]="0")

POSIXLY_CORRECT=y

PPID=22660

PS4='+ '

PWD=/

SHELL=/bin/bash

SHELLOPTS=braceexpand:hashall:interactive-comments:posix

SHLVL=2

TERM=dumb

UID=103

USER=rancid

_=export

/



From: Rancid-discuss [mailto:rancid-discuss-***@shrubbery.net] On Behalf
Of Alex DEKKER
Sent: Tuesday, October 3, 2017 5:53 PM
To: rancid-***@shrubbery.net
Subject: Re: [rancid] problem with rancid crontab



On 03/10/17 15:37, Vacheslav wrote:

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?




If there really is a ^M on the first line of the script then that suggests
it was created with "DOS" line endings. What are you using to edit files? I
can imagine that unexpected DOS line endings will cause the various
components of RANCID to fail in unexpected ways.

alexd
Vacheslav
2017-10-04 05:44:28 UTC
Permalink
So how to change home from / to /var/rancid?



From: Rancid-discuss [mailto:rancid-discuss-***@shrubbery.net] On Behalf
Of Vacheslav
Sent: Tuesday, October 3, 2017 5:59 PM
To: 'Alex DEKKER' <***@ale.cx>; rancid-***@shrubbery.net
Subject: Re: [rancid] problem with rancid crontab



Good observation, I was creating it using winscp, now I nanoed it and the
log file produced:
export HOME="/"

export LANG="en_US.utf8"

export LOGNAME="rancid"

export MAILTO="root"

export OLDPWD

export PATH="/sbin:/bin:/usr/sbin:/usr/bin"

export PWD="/"

export SHELL="/bin/bash"

export SHLVL="2"

export USER="rancid"

export _="/tmp/test2.sh"

BASH=/bin/sh

BASHOPTS=cmdhist:complete_fullquote:extquote:force_fignore:hostcomplete:inte
ractive_comments:progcomp:promptvars:sourcepath

BASH_ALIASES=()

BASH_ARGC=()

BASH_ARGV=()

BASH_CMDS=()

BASH_LINENO=([0]="0")

BASH_SOURCE=([0]="/tmp/test2.sh")

BASH_VERSINFO=([0]="4" [1]="3" [2]="48" [3]="1" [4]="release"
[5]="x86_64-pc-linux-gnu")

BASH_VERSION='4.3.48(1)-release'

DIRSTACK=()

EUID=103

GROUPS=()

HOME=/

HOSTNAME=nagios

HOSTTYPE=x86_64

IFS='

'

LANG=en_US.utf8

LOGNAME=rancid

MACHTYPE=x86_64-pc-linux-gnu

MAILTO=root

OPTERR=1

OPTIND=1

OSTYPE=linux-gnu

PATH=/sbin:/bin:/usr/sbin:/usr/bin

PIPESTATUS=([0]="0")

POSIXLY_CORRECT=y

PPID=22660

PS4='+ '

PWD=/

SHELL=/bin/bash

SHELLOPTS=braceexpand:hashall:interactive-comments:posix

SHLVL=2

TERM=dumb

UID=103

USER=rancid

_=export

/



From: Rancid-discuss [mailto:rancid-discuss-***@shrubbery.net] On Behalf
Of Alex DEKKER
Sent: Tuesday, October 3, 2017 5:53 PM
To: rancid-***@shrubbery.net <mailto:rancid-***@shrubbery.net>
Subject: Re: [rancid] problem with rancid crontab



On 03/10/17 15:37, Vacheslav wrote:

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?




If there really is a ^M on the first line of the script then that suggests
it was created with "DOS" line endings. What are you using to edit files? I
can imagine that unexpected DOS line endings will cause the various
components of RANCID to fail in unexpected ways.

alexd
Alexander Griesser
2017-10-04 05:52:55 UTC
Permalink
What operating system is this? I'm not sure why this is happening for you, but this might as well be just because you're running the jobs in the system cron and the environment is not being passed to the script upon execution.

Can you please just try to add this crontab line to the rancid user's cron?
i.e. login as user rancid (f.ex. `su - rancid`) and then run `crontab -e` and add the cron there? This should definitely fix it.
The only change necessary in the crontab line is to remove the column with the username "rancid".

best,

Alexander Griesser
Head of Systems Operations

ANEXIA Internetdienstleistungs GmbH

E-Mail: ***@anexia-it.com<mailto:***@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-***@shrubbery.net] Im Auftrag von Vacheslav
Gesendet: Mittwoch, 4. Oktober 2017 07:44
An: 'Alex DEKKER' <***@ale.cx>; rancid-***@shrubbery.net
Betreff: Re: [rancid] problem with rancid crontab

So how to change home from / to /var/rancid?

From: Rancid-discuss [mailto:rancid-discuss-***@shrubbery.net] On Behalf Of Vacheslav
Sent: Tuesday, October 3, 2017 5:59 PM
To: 'Alex DEKKER' <***@ale.cx<mailto:***@ale.cx>>; rancid-***@shrubbery.net<mailto:rancid-***@shrubbery.net>
Subject: Re: [rancid] problem with rancid crontab

Good observation, I was creating it using winscp, now I nanoed it and the log file produced:
export HOME="/"
export LANG="en_US.utf8"
export LOGNAME="rancid"
export MAILTO="root"
export OLDPWD
export PATH="/sbin:/bin:/usr/sbin:/usr/bin"
export PWD="/"
export SHELL="/bin/bash"
export SHLVL="2"
export USER="rancid"
export _="/tmp/test2.sh"
BASH=/bin/sh
BASHOPTS=cmdhist:complete_fullquote:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_LINENO=([0]="0")
BASH_SOURCE=([0]="/tmp/test2.sh")
BASH_VERSINFO=([0]="4" [1]="3" [2]="48" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu")
BASH_VERSION='4.3.48(1)-release'
DIRSTACK=()
EUID=103
GROUPS=()
HOME=/
HOSTNAME=nagios
HOSTTYPE=x86_64
IFS='
'
LANG=en_US.utf8
LOGNAME=rancid
MACHTYPE=x86_64-pc-linux-gnu
MAILTO=root
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PIPESTATUS=([0]="0")
POSIXLY_CORRECT=y
PPID=22660
PS4='+ '
PWD=/
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments:posix
SHLVL=2
TERM=dumb
UID=103
USER=rancid
_=export
/

From: Rancid-discuss [mailto:rancid-discuss-***@shrubbery.net] On Behalf Of Alex DEKKER
Sent: Tuesday, October 3, 2017 5:53 PM
To: rancid-***@shrubbery.net<mailto:rancid-***@shrubbery.net>
Subject: Re: [rancid] problem with rancid crontab

On 03/10/17 15:37, Vacheslav wrote:
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?


If there really is a ^M on the first line of the script then that suggests it was created with "DOS" line endings. What are you using to edit files? I can imagine that unexpected DOS line endings will cause the various components of RANCID to fail in unexpected ways.

alexd
Vacheslav
2017-10-13 11:25:34 UTC
Permalink
Well I copied .cloginrc to the / directory and now it’s working, I’m happy J



From: Alexander Griesser [mailto:***@anexia-it.com]
Sent: Wednesday, October 4, 2017 8:53 AM
To: Vacheslav <***@skno.by>; 'Alex DEKKER' <***@ale.cx>;
rancid-***@shrubbery.net
Subject: AW: [rancid] problem with rancid crontab



What operating system is this? I’m not sure why this is happening for you,
but this might as well be just because you’re running the jobs in the system
cron and the environment is not being passed to the script upon execution.



Can you please just try to add this crontab line to the rancid user’s cron?

i.e. login as user rancid (f.ex. `su – rancid`) and then run `crontab -e`
and add the cron there? This should definitely fix it.

The only change necessary in the crontab line is to remove the column with
the username „rancid“.



best,



Alexander Griesser

Head of Systems Operations



ANEXIA Internetdienstleistungs GmbH



E-Mail: <mailto:***@anexia-it.com> ***@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-***@shrubbery.net] Im Auftrag
von Vacheslav
Gesendet: Mittwoch, 4. Oktober 2017 07:44
An: 'Alex DEKKER' <***@ale.cx <mailto:***@ale.cx> >;
rancid-***@shrubbery.net <mailto:rancid-***@shrubbery.net>
Betreff: Re: [rancid] problem with rancid crontab



So how to change home from / to /var/rancid?



From: Rancid-discuss [mailto:rancid-discuss-***@shrubbery.net] On Behalf
Of Vacheslav
Sent: Tuesday, October 3, 2017 5:59 PM
To: 'Alex DEKKER' <***@ale.cx <mailto:***@ale.cx> >;
rancid-***@shrubbery.net <mailto:rancid-***@shrubbery.net>
Subject: Re: [rancid] problem with rancid crontab



Good observation, I was creating it using winscp, now I nanoed it and the
log file produced:
export HOME="/"

export LANG="en_US.utf8"

export LOGNAME="rancid"

export MAILTO="root"

export OLDPWD

export PATH="/sbin:/bin:/usr/sbin:/usr/bin"

export PWD="/"

export SHELL="/bin/bash"

export SHLVL="2"

export USER="rancid"

export _="/tmp/test2.sh"

BASH=/bin/sh

BASHOPTS=cmdhist:complete_fullquote:extquote:force_fignore:hostcomplete:inte
ractive_comments:progcomp:promptvars:sourcepath

BASH_ALIASES=()

BASH_ARGC=()

BASH_ARGV=()

BASH_CMDS=()

BASH_LINENO=([0]="0")

BASH_SOURCE=([0]="/tmp/test2.sh")

BASH_VERSINFO=([0]="4" [1]="3" [2]="48" [3]="1" [4]="release"
[5]="x86_64-pc-linux-gnu")

BASH_VERSION='4.3.48(1)-release'

DIRSTACK=()

EUID=103

GROUPS=()

HOME=/

HOSTNAME=nagios

HOSTTYPE=x86_64

IFS='

'

LANG=en_US.utf8

LOGNAME=rancid

MACHTYPE=x86_64-pc-linux-gnu

MAILTO=root

OPTERR=1

OPTIND=1

OSTYPE=linux-gnu

PATH=/sbin:/bin:/usr/sbin:/usr/bin

PIPESTATUS=([0]="0")

POSIXLY_CORRECT=y

PPID=22660

PS4='+ '

PWD=/

SHELL=/bin/bash

SHELLOPTS=braceexpand:hashall:interactive-comments:posix

SHLVL=2

TERM=dumb

UID=103

USER=rancid

_=export

/



From: Rancid-discuss [mailto:rancid-discuss-***@shrubbery.net] On Behalf
Of Alex DEKKER
Sent: Tuesday, October 3, 2017 5:53 PM
To: rancid-***@shrubbery.net <mailto:rancid-***@shrubbery.net>
Subject: Re: [rancid] problem with rancid crontab



On 03/10/17 15:37, Vacheslav wrote:

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?




If there really is a ^M on the first line of the script then that suggests
it was created with "DOS" line endings. What are you using to edit files? I
can imagine that unexpected DOS line endings will cause the various
components of RANCID to fail in unexpected ways.

alexd

Loading...