[rancid] F5 backups are only working for some hosts via cron, but always manually

Alan McKinnon alan.mckinnon at gmail.com
Thu Dec 5 19:35:18 UTC 2013


On 05/12/2013 17:22, Stephan Seitz wrote:
> On Wed, Dec 04, 2013 at 10:05:51PM +0200, Alan McKinnon wrote:
>> This is a common problem with cron and has little to do with the program
>> being run and everything to do with the environment. Cron does not run
> 
> Well, I can say after several tests that I have probably found the
> problem, but I don’t understand it.
> 
> The command:
> clogin -t 90 -c"bigpipe version;bigpipe platform;cat
> /config/bigip.license;bigpipe monitor list all;bigpipe profile
> list;bigpipe base list;bigpipe db show;bigpipe route static show;ls
> --full-time --color=never /config/ssl/ssl.crt;ls --full-time
> --color=never /config/ssl/ssl.key;bigpipe list" bigip2b
> 
> a) called directly from the rancid user shell
> b) called from the root shell via „su - rancid -c <command>”
> 
> Looking at the different outputs of the problematic lines I can see the
> following:
> a)
> [root at bigip2b:Standby] config # ls --full-time --color=never
> /config/ssl/ssl.crt^M
> <output>
> [root at bigip2b:Standby] config # ls --full-time --color=never
> /config/ssl/ssl.key^M
> <output>
> [root at bigip2b:Standby] config # bigpipe list^M
> <output>
> 
> b)
> [root at bigip2b:Standby] config # ls --full-time --color=never
> /config/ssl/ssl.crt ^M^[[A[root at bigip2b:Standby] config # ls --full-time
> --color=never /config/ssl/ssl.cr^[[Kt^M
> <output>
> ls --full-time --color=never /config/ssl/ssl.key^M
> [root at bigip2b:Standby] config # ls --full-time --color=never
> /config/ssl/ssl.key ^M^[[A[root at bigip2b:Standby] config #total 64^M
> <output>
> e[root at bigip2b:Standby] config # bigpipe list^M
> <output>
> 
> So besides the CR characters the second output shows some other control
> characters which probably confuses the parser in the end.
> 
> Is this the right conclusion? But why do I get these additional control
> characters in the second case?

Those ANSI escape sequences containing "[" are never supposed to be
echoed to the screen at all, they are controls to the terminal emulator
to take some action or other.

To see why you get them in case b) look the the man page for su under
option -c:

       -c, --command COMMAND
           Specify a command that will be invoked by the shell using its -c.

           The executed command will have no controlling terminal. This
option cannot be used to
           execute interractive programs which need a controlling TTY.

You disable the terminal emulator with -c, so the escape sequences are
passed through and not acted on.

We now need to check what actually happens in your cron jobs. What is
the content of rancid.conf, especially the settings NOPIPE, PATH and TERM?

-- 
Alan McKinnon
alan.mckinnon at gmail.com



More information about the Rancid-discuss mailing list