From: Alan McKinnon <alan.mckinnon@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Using 'time' command in crontab?
Date: Thu, 11 Jul 2013 13:21:27 +0200 [thread overview]
Message-ID: <51DE9537.4070205@gmail.com> (raw)
In-Reply-To: <51DE9408.8040303@libertytrek.org>
On 11/07/2013 13:16, Tanstaafl wrote:
> Hi all,
>
> Ok, I want to use the time command in my crontab...
>
> Working crontab entry:
>
>> 58 6,11,16,21 * * * rsnapshot -c /etc/rsnapshot/myhost.conf sync;
>> rsnapshot -c /etc/rsnapshot/myhost.conf hourly
>
> Non-working (with time command added):
>
>> 58 6,11,16,21 * * * time { rsnapshot -c /etc/rsnapshot/myhost.conf
>> sync; rsnapshot -c /etc/rsnapshot/myhost.conf hourly }
>
> Adding the time { } to the command results in the following error being
> emailed:
>
> /bin/sh: -c: line 1: syntax error: unexpected end of file
>
> Obviously this is more proof of my lack of understanding bash, but
> googling hasn't revealed a solution, so any help is appreciated...
>
> Thanks
>
replace the braces {} with parenthesis ().
braces do many interesting things in bash such as sequences {1..10} and
delimiting variables ${INSERT_VAR_NAME_HERE} but you want to group
several commands and run them in a subshell, parenthesis does that.
--
Alan McKinnon
alan.mckinnon@gmail.com
next prev parent reply other threads:[~2013-07-11 11:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-11 11:16 [gentoo-user] Using 'time' command in crontab? Tanstaafl
2013-07-11 11:21 ` Alan McKinnon [this message]
2013-07-11 11:37 ` Tanstaafl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51DE9537.4070205@gmail.com \
--to=alan.mckinnon@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox