* [gentoo-user] Using 'time' command in crontab?
@ 2013-07-11 11:16 Tanstaafl
2013-07-11 11:21 ` Alan McKinnon
0 siblings, 1 reply; 3+ messages in thread
From: Tanstaafl @ 2013-07-11 11:16 UTC (permalink / raw
To: gentoo-user
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-user] Using 'time' command in crontab?
2013-07-11 11:16 [gentoo-user] Using 'time' command in crontab? Tanstaafl
@ 2013-07-11 11:21 ` Alan McKinnon
2013-07-11 11:37 ` Tanstaafl
0 siblings, 1 reply; 3+ messages in thread
From: Alan McKinnon @ 2013-07-11 11:21 UTC (permalink / raw
To: gentoo-user
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-user] Using 'time' command in crontab?
2013-07-11 11:21 ` Alan McKinnon
@ 2013-07-11 11:37 ` Tanstaafl
0 siblings, 0 replies; 3+ messages in thread
From: Tanstaafl @ 2013-07-11 11:37 UTC (permalink / raw
To: gentoo-user
On 2013-07-11 7:21 AM, Alan McKinnon <alan.mckinnon@gmail.com> wrote:
> On 11/07/2013 13:16, Tanstaafl wrote:
>> 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...
> 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.
Crap, figured it would be something simple...
Thanks Alan...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-11 11:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-11 11:16 [gentoo-user] Using 'time' command in crontab? Tanstaafl
2013-07-11 11:21 ` Alan McKinnon
2013-07-11 11:37 ` Tanstaafl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox