1 |
On 11/07/2013 13:16, Tanstaafl wrote: |
2 |
> Hi all, |
3 |
> |
4 |
> Ok, I want to use the time command in my crontab... |
5 |
> |
6 |
> Working crontab entry: |
7 |
> |
8 |
>> 58 6,11,16,21 * * * rsnapshot -c /etc/rsnapshot/myhost.conf sync; |
9 |
>> rsnapshot -c /etc/rsnapshot/myhost.conf hourly |
10 |
> |
11 |
> Non-working (with time command added): |
12 |
> |
13 |
>> 58 6,11,16,21 * * * time { rsnapshot -c /etc/rsnapshot/myhost.conf |
14 |
>> sync; rsnapshot -c /etc/rsnapshot/myhost.conf hourly } |
15 |
> |
16 |
> Adding the time { } to the command results in the following error being |
17 |
> emailed: |
18 |
> |
19 |
> /bin/sh: -c: line 1: syntax error: unexpected end of file |
20 |
> |
21 |
> Obviously this is more proof of my lack of understanding bash, but |
22 |
> googling hasn't revealed a solution, so any help is appreciated... |
23 |
> |
24 |
> Thanks |
25 |
> |
26 |
|
27 |
|
28 |
replace the braces {} with parenthesis (). |
29 |
|
30 |
braces do many interesting things in bash such as sequences {1..10} and |
31 |
delimiting variables ${INSERT_VAR_NAME_HERE} but you want to group |
32 |
several commands and run them in a subshell, parenthesis does that. |
33 |
|
34 |
|
35 |
|
36 |
-- |
37 |
Alan McKinnon |
38 |
alan.mckinnon@×××××.com |