From owner-freebsd-questions Tue Jan 15 19:14:49 2002 Delivered-To: freebsd-questions@freebsd.org Received: from lanalyse.com (hh1105203.direcpc.com [206.71.105.203]) by hub.freebsd.org (Postfix) with ESMTP id 31F8A37B400 for ; Tue, 15 Jan 2002 19:14:41 -0800 (PST) Received: from cross (Cross.lanalyse.com [192.168.0.1]) by FreeBSD.lanalyse.com (8.11.6/8.11.6) with SMTP id g0G3DsQ17951; Tue, 15 Jan 2002 22:13:54 -0500 (EST) (envelope-from ronh@intercom.net) Message-ID: <00ac01c19e3a$ee503450$0273150a@woodstock.lanalyse.com> From: "Ron Hensley" To: "ann kok" , "Jan Grant" Cc: "questions" References: <20020116024727.49626.qmail@web20108.mail.yahoo.com> Subject: Re: crontab to backup mail in date format Date: Tue, 15 Jan 2002 21:54:29 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I find its generally a lot easier to just have cron run a script file. In the script file is where you do all the metacharacters, date formatting, special programming, etc. You can test you script by running it from the command line until you know its working perfectly then add a cron entry to run your script whenever you wish. Adding a fancy entry with lots of arguments in the crontab itself, and then having to wait for it to run when schedualed, just to see if it worked can be a real pain. Just my 2 cents for what its worth (About 1/4 of apenny these days!) - ----- Original Message ----- From: "ann kok" To: "Jan Grant" Cc: "questions" Sent: Tuesday, January 15, 2002 9:47 PM Subject: Re: crontab to backup mail in date format > --- Dear Jan > > Thank you. It works now > > But how do I know that % doesn't work in crontab? > > BTW, I met another problem. There will be many backup > in the server by date format > > How do I create cron to delete the date format backup > after 3 days automatically again? > > Thank you again > > > Jan Grant wrote: > > On Mon, 14 Jan 2002, ann kok wrote: > > > > > Hi all > > > > > > I have problem about crontab to backup mail in > > date > > > format > > > > > > error from root: > > > /bin/sh: unexpected EOF while looking for ``' > > > >/bin/sh: -c: line 2: syntax erro > > > > > > > > > My contrab is as follows: > > > > > > 5 21 * * * tar czvf /backup/`date > > > "+%Y-%m-%d"`home.tar.gz /home > /dev/null 2>&1 > > > 59 23 * * * tar cvf /backup/`date > > > "+%Y-%m-%d"`backupmail.tar /mail > /dev/null 2>&1 > > > > % characters in crontab are turned into newlines > > when the whole thing is > > sent to the shell; turn the command line into a > > little script and call > > that from cron. > > > > > > -- > > jan grant, ILRT, University of Bristol. > > http://www.ilrt.bris.ac.uk/ > > Tel +44(0)117 9287088 Fax +44 (0)117 9287112 RFC822 > > jan.grant@bris.ac.uk > > Strive to live every day as though it was last > > Wednesday. > > > > > __________________________________________________ > Do You Yahoo!? > Send FREE video emails in Yahoo! Mail! > http://promo.yahoo.com/videomail/ > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 6.5.8 for non-commercial use iQA/AwUBPETrY1Fb04N5DzUjEQJgjACfezTG7og7xHLtogHMOsbWvXu7rykAoJVg Ri42rqIRfWaZSMUBKpZCW2gT =4ECi -----END PGP SIGNATURE----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message