[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to use logrotate postrotate *bash* script



On Thu, 2013-12-05 at 10:44 +0100, Ralf Mardorf wrote:
> On Thu, 2013-12-05 at 10:43 +0100, Ralf Mardorf wrote:
> > On Thu, 2013-12-05 at 10:31 +0100, Steffen Dettmer wrote:
> > > logrotate seems to execute "postrotate" scripts using /bin/sh and I
> > > found no way where to specify which script interpreter to use.
> > > Starting with a she-bang line seem to have no effect. Even if I
> > > manually run logrotate as root who has /bin/bash as login shell,
> > > /bin/sh is used.
> > > 
> > > How to make logrotate to use the correct interpreter for "postrotate" scripts?
> > 
> > The Magic line is used, if you run it directly
> > 
> > myscript
> > 
> > using
> > 
> > sh myscript
> > dash myscript
> > bash myscript
> > 
> > will use the named bash. sh usually is a link to bash or dash. Sometimes
>                     ^^^^^ shell ;), bash, dash or whatever you type for
                                                    before           ^^
> myscript
> > it's smart to write scripts that run with dash and bash.
> > 
> > Regards,
> > Ralf
> > 
> 

I'm sorry, I won't correct additional mistakes, but since my English is
broken, it might be unclear what I mean.

If you rewrite the script, don't change the shebang, but the line that
does execute the other script. change sh otherscript to bash otherscript
or dash otherscript or something else.



Reply to: