Re: backslash in crontab
From: Matthew Seaman (m.seaman_at_infracaninophile.co.uk)
Date: 05/31/03
- Previous message: Vitalis: "/stand/sysinstall with upgraded 5.1-BETA"
- In reply to: Antoine Jacoutot: "backslash in crontab"
- Next in thread: Antoine Jacoutot: "Re: backslash in crontab"
- Reply: Antoine Jacoutot: "Re: backslash in crontab"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sat, 31 May 2003 11:04:36 +0100 To: Antoine Jacoutot <ajacoutot@lphp.org>
On Sat, May 31, 2003 at 10:49:34AM +0200, Antoine Jacoutot wrote:
> Hi !
>
> How can I have one big line in my crontab splitted in multiple lines ?
> I tried the following:
>
> 0 2 * * * command A && \
> command B && \
> command C
>
> But I get the following error message:
>
> /tmp/crontab.48pe18LXs2: 10 lines, 1344 characters.
> crontab: installing new crontab
> "/tmp/crontab.48pe18LXs2":9: bad hour
> crontab: errors in crontab file, can't install
> Do you want to retry the same edit?
>
> Note that if my crontab is written as:
>
> 0 2 * * * command A && command B && command C
> ... then it works with no problem.
Yes -- the entry in the crontab file has to be all on one line, as
you've discovered. If you absolutely have to reformat things, then
generally the way to go is to create a shell script containing your
complex command and run that out of cron instead:
crontab entry:
0 2 * * * myscript
% cat <<E_O_SCRIPT > myscript
#!/bin/sh
command A && \
command B && \
command C
E_O_SCRIPT
Cheers,
Matthew
--
Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks
Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614 Bucks., SL7 1TH UK
- application/pgp-signature attachment: stored
- Previous message: Vitalis: "/stand/sysinstall with upgraded 5.1-BETA"
- In reply to: Antoine Jacoutot: "backslash in crontab"
- Next in thread: Antoine Jacoutot: "Re: backslash in crontab"
- Reply: Antoine Jacoutot: "Re: backslash in crontab"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
- Re: Running DBI, ODBC in the crontab
... Run the following lines in both the command line and crontab: ... Any
of the paths that are missing in cron ... This communication is issued by UBS AG
or an affiliate by the ... (perl.dbi.users) - Re: GPG in crontab causes blank messages
... When I run my crontab command manually in terminal, ... But since the output
of the script contains a big list of files, ... If I remove the GPG portion of the
command, ... (comp.sys.mac.apps) - Re: crontab issue
... your environment ... ... Simon is absolutely right about the script ...
... crontab file ugly, just because you can? ... solved by making the command
a separate script. ... (AIX-L) - Re: crontab issue
... I think the problem can be resolved by adding a backslash before the ... existing
backslash in the find command. ... the crontab entry should read - ... (AIX-L) - Re: crontab related .. again
... >>> The above command works fine with the following ... >>>
This latter script work in command line. ... > Yes crontab allow */1 specificatin.
... > How to know the cron's working directory how to make the current ... (comp.unix.shell)