[rancid] Issues running rancid from cron on Ubuntu..

heasley heas at shrubbery.net
Thu Jun 16 22:19:19 UTC 2016


Thu, Jun 16, 2016 at 09:36:11PM +0000, heasley:
> Thu, Jun 16, 2016 at 03:14:13PM -0400, Howard Leadmon:
> >  FYI, I did get it sorted out, but strange more haven't run into this unless
> > my environment is screwy for some reason.
> > 
> > I had to set the USER name in the environment.   I looked at the
> > environment, and saw LOGNAME=rancid, but that I didn't see USER= rancid.
> > So in the crontab I set USER=rancid, and off everything went..

this will help.  not all of the login scripts use this file yet, but it can
be applied to the others.

Index: bin/login_top.in
===================================================================
--- bin/login_top.in	(revision 3410)
+++ bin/login_top.in	(revision 3412)
@@ -2,13 +2,22 @@
 #	x == do not set xterm banner or name
 
 # Find the user in the ENV, or use the unix userid.
-if {[info exists env(CISCO_USER)]} {
-    set default_user $env(CISCO_USER)
-} elseif {[info exists env(USER)]} {
-    set default_user $env(USER)
-} elseif {[info exists env(LOGNAME)]} {
-    set default_user $env(LOGNAME)
-} else {
+if {![info exists default_user] && [info exists env(CISCO_USER)]} {
+    if {[string length $env(CISCO_USER)]} {
+	set default_user $env(CISCO_USER)
+    }
+}
+if {![info exists default_user] && [info exists env(USER)]} {
+    if {[string length $env(USER)]} {
+	set default_user $env(USER)
+    }
+}
+if {![info exists default_user] && [info exists env(LOGNAME)]} {
+    if {[string length $env(LOGNAME)]} {
+	set default_user $env(LOGNAME)
+    }
+}
+if (![info exists default_user]) {
     # This uses "id" which I think is portable.  At least it has existed
     # (without options) on all machines/OSes I've been on recently -
     # unlike whoami or id -nu.



More information about the Rancid-discuss mailing list