* [gentoo-user] chrony logrotate script EOF error
@ 2010-08-22 10:11 Mick
2010-08-22 10:25 ` Alex Schuster
2010-08-22 16:25 ` Alan McKinnon
0 siblings, 2 replies; 7+ messages in thread
From: Mick @ 2010-08-22 10:11 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: Text/Plain, Size: 863 bytes --]
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?
--
Regards,
Mick
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] chrony logrotate script EOF error
2010-08-22 10:11 [gentoo-user] chrony logrotate script EOF error Mick
@ 2010-08-22 10:25 ` Alex Schuster
2010-08-22 14:50 ` Mick
2010-08-22 16:25 ` Alan McKinnon
1 sibling, 1 reply; 7+ messages in thread
From: Alex Schuster @ 2010-08-22 10:25 UTC (permalink / raw
To: gentoo-user
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] chrony logrotate script EOF error
2010-08-22 10:25 ` Alex Schuster
@ 2010-08-22 14:50 ` Mick
0 siblings, 0 replies; 7+ messages in thread
From: Mick @ 2010-08-22 14:50 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: Text/Plain, Size: 1322 bytes --]
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
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] chrony logrotate script EOF error
2010-08-22 10:11 [gentoo-user] chrony logrotate script EOF error Mick
2010-08-22 10:25 ` Alex Schuster
@ 2010-08-22 16:25 ` Alan McKinnon
2010-08-22 16:44 ` Mick
1 sibling, 1 reply; 7+ messages in thread
From: Alan McKinnon @ 2010-08-22 16:25 UTC (permalink / raw
To: gentoo-user
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] chrony logrotate script EOF error
2010-08-22 16:25 ` Alan McKinnon
@ 2010-08-22 16:44 ` Mick
2010-08-22 16:50 ` Alan McKinnon
0 siblings, 1 reply; 7+ messages in thread
From: Mick @ 2010-08-22 16:44 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: Text/Plain, Size: 1529 bytes --]
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
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] chrony logrotate script EOF error
2010-08-22 16:44 ` Mick
@ 2010-08-22 16:50 ` Alan McKinnon
2010-08-22 18:01 ` Mick
0 siblings, 1 reply; 7+ messages in thread
From: Alan McKinnon @ 2010-08-22 16:50 UTC (permalink / raw
To: gentoo-user
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] chrony logrotate script EOF error
2010-08-22 16:50 ` Alan McKinnon
@ 2010-08-22 18:01 ` Mick
0 siblings, 0 replies; 7+ messages in thread
From: Mick @ 2010-08-22 18:01 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: Text/Plain, Size: 943 bytes --]
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
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-08-22 18:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-22 10:11 [gentoo-user] chrony logrotate script EOF error Mick
2010-08-22 10:25 ` Alex Schuster
2010-08-22 14:50 ` Mick
2010-08-22 16:25 ` Alan McKinnon
2010-08-22 16:44 ` Mick
2010-08-22 16:50 ` Alan McKinnon
2010-08-22 18:01 ` Mick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox