FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 08-22-2010, 10:25 AM
Alex Schuster
 
Default chrony logrotate script EOF error

Mick writes:

> The chrony installed logrotate script keeps erroring out:
> ================================================== ======
> logrotate_script: line 5: warning: here-document at line 2 delimited by
> end- of-file (wanted `EOF')
> Unrecognized command
> ================================================== ======
>
> This is the script:
> ================================================== ======
> /var/log/chrony/*.log {
> sharedscripts
> postrotate
> PASSWORD=`awk '$1 ~ /^1$/ {print $2; exit}'
> /etc/chrony/chrony.keys`
> cat << EOF | /usr/bin/chronyc | sed '/^200 OK$/d'
> password $PASSWORD
> cyclelogs
> EOF
> endscript
> }
> ================================================== ======
>
> I do not understand the error. Is it telling me to add backticks?
> Where?

I don't know the logrotate syntax, but in bash this would not work if the
ending EOF has leading whitespace. Try replacing the '<<' by '<<-', then
whitespace is allowed.

Wonko
 
Old 08-22-2010, 02:50 PM
Mick
 
Default chrony logrotate script EOF error

On Sunday 22 August 2010 11:25:05 Alex Schuster wrote:
> Mick writes:
> > The chrony installed logrotate script keeps erroring out:
> > ================================================== ======
> > logrotate_script: line 5: warning: here-document at line 2 delimited by
> > end- of-file (wanted `EOF')
> > Unrecognized command
> > ================================================== ======
> >
> > This is the script:
> > ================================================== ======
> > /var/log/chrony/*.log {
> >
> > sharedscripts
> > postrotate
> >
> > PASSWORD=`awk '$1 ~ /^1$/ {print $2; exit}'
> >
> > /etc/chrony/chrony.keys`
> >
> > cat << EOF | /usr/bin/chronyc | sed '/^200 OK$/d'
> > password $PASSWORD
> > cyclelogs
> > EOF
> >
> > endscript
> >
> > }
> > ================================================== ======
> >
> > I do not understand the error. Is it telling me to add backticks?
> > Where?
>
> I don't know the logrotate syntax, but in bash this would not work if the
> ending EOF has leading whitespace. Try replacing the '<<' by '<<-', then
> whitespace is allowed.

Thanks! I've used your suggestion and will see if the error goes away.
--
Regards,
Mick
 
Old 08-22-2010, 04:25 PM
Alan McKinnon
 
Default chrony logrotate script EOF error

Apparently, though unproven, at 12:11 on Sunday 22 August 2010, Mick did opine
thusly:

> Hi All,
>
> The chrony installed logrotate script keeps erroring out:
> ================================================== ======
> logrotate_script: line 5: warning: here-document at line 2 delimited by
> end- of-file (wanted `EOF')
> Unrecognized command
> ================================================== ======
>
> This is the script:
> ================================================== ======
> /var/log/chrony/*.log {
> sharedscripts
> postrotate
> PASSWORD=`awk '$1 ~ /^1$/ {print $2; exit}'
> /etc/chrony/chrony.keys`
> cat << EOF | /usr/bin/chronyc | sed '/^200 OK$/d'
> password $PASSWORD
> cyclelogs
> EOF
> endscript
> }
> ================================================== ======
>
> I do not understand the error. Is it telling me to add backticks? Where?


No, it's saying it wants EOF on a line all by itself with no leading
whitespace. That thing that looks like a backtick is an open quote.


--
alan dot mckinnon at gmail dot com
 
Old 08-22-2010, 04:44 PM
Mick
 
Default chrony logrotate script EOF error

On Sunday 22 August 2010 17:25:02 Alan McKinnon wrote:
> Apparently, though unproven, at 12:11 on Sunday 22 August 2010, Mick did
> opine
>
> thusly:
> > Hi All,
> >
> > The chrony installed logrotate script keeps erroring out:
> > ================================================== ======
> > logrotate_script: line 5: warning: here-document at line 2 delimited by
> > end- of-file (wanted `EOF')
> > Unrecognized command
> > ================================================== ======
> >
> > This is the script:
> > ================================================== ======
> > /var/log/chrony/*.log {
> >
> > sharedscripts
> > postrotate
> >
> > PASSWORD=`awk '$1 ~ /^1$/ {print $2; exit}'
> >
> > /etc/chrony/chrony.keys`
> >
> > cat << EOF | /usr/bin/chronyc | sed '/^200 OK$/d'
> > password $PASSWORD
> > cyclelogs
> > EOF
> >
> > endscript
> >
> > }
> > ================================================== ======
> >
> > I do not understand the error. Is it telling me to add backticks?
> > Where?
>
> No, it's saying it wants EOF on a line all by itself with no leading
> whitespace. That thing that looks like a backtick is an open quote.

Hmm ... so what should the corrected logrotate script look like then?

cat <<
EOF
| /usr/bin/chronyc | sed '/^200 OK$/d'
password $PASSWORD
cyclelogs
EOF
endscript
}
--
Regards,
Mick
 
Old 08-22-2010, 04:50 PM
Alan McKinnon
 
Default chrony logrotate script EOF error

Apparently, though unproven, at 18:44 on Sunday 22 August 2010, Mick did opine
thusly:

> > No, it's saying it wants EOF on a line all by itself with no leading
> > whitespace. That thing that looks like a backtick is an open quote.
>
> Hmm ... so what should the corrected logrotate script look like then?
>
> cat <<
> EOF
> | /usr/bin/chronyc | sed '/^200 OK$/d'
> password $PASSWORD
> cyclelogs
> EOF
> endscript
> }


Change the other EOF instead.

It's a "here document", search for that phrase in man bash to find out more.
It tells bash what will cause input redirection from stdin to end. The first
EOF is the string to look for, the second one is the trigger that ends input

--
alan dot mckinnon at gmail dot com
 
Old 08-22-2010, 06:01 PM
Mick
 
Default chrony logrotate script EOF error

On Sunday 22 August 2010 17:50:02 Alan McKinnon wrote:
> Apparently, though unproven, at 18:44 on Sunday 22 August 2010, Mick did
> opine
>
> thusly:
> > > No, it's saying it wants EOF on a line all by itself with no leading
> > > whitespace. That thing that looks like a backtick is an open quote.
> >
> > Hmm ... so what should the corrected logrotate script look like then?
> >
> > cat <<
> >
> > EOF
> >
> > | /usr/bin/chronyc | sed '/^200 OK$/d'
> >
> > password $PASSWORD
> > cyclelogs
> > EOF
> >
> > endscript
> > }
>
> Change the other EOF instead.
>
> It's a "here document", search for that phrase in man bash to find out
> more. It tells bash what will cause input redirection from stdin to end.
> The first EOF is the string to look for, the second one is the trigger
> that ends input

Thanks Alan, I think I got it now. :-)
--
Regards,
Mick
 

Thread Tools




All times are GMT. The time now is 01:35 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org