My idea was to automate some back-up jobs. I went to directory /var/cron/tabs and there created a new file <rootcron> Firstly, I have the command :- < crontab -l >rootcron > next, I editied rootcron to tell it when to do what. Finally I gave the command < crontab rootcron > This had the result, to write the instructions in /var/cron/tabs/root BUT, the appointed hour came and went . . . Nothing happened :( Any clues what I should have done ? Thanks -- ____________ sent on Linux ____________ ___________________________________________________________________________ Message envoye depuis iFrance : http://www.ifrance.com ou 3615 IFRANCE Gratuit : Hebergement (50 Mo)/Vos emails (POP,HTML,20 Mo, FAX)/Votre agenda -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
hi
i recently set up cron to run a mail retrieval program three times a day.
just edit the /etc/crontab file and add entries in there. take a look at man
5 crontab for the syntax. for example, i used:
30 8,12,4 * * 1-6 /sbin/mailrun -v
to run my 'mailrun' script at 8:30, 12:30 and 4:30 every day except sunday.
i hope this helps,
Andrew
----- Original Message -----
From: tabanna
My idea was to automate some back-up jobs.
I went to directory /var/cron/tabs and there created a new file <rootcron>
Firstly, I have the command :- < crontab -l >rootcron > next, I editied rootcron to tell it when to do what. Finally I gave the command < crontab rootcron >
This had the result, to write the instructions in /var/cron/tabs/root
BUT, the appointed hour came and went . . . Nothing happened :(
Any clues what I should have done ?
Thanks -- ____________ sent on Linux ____________
___________________________________________________________________________
Message envoye depuis iFrance : http://www.ifrance.com ou 3615 IFRANCE Gratuit : Hebergement (50 Mo)/Vos emails (POP,HTML,20 Mo, FAX)/Votre agenda
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
I just run "crontab -e" (e for edit) as the user I want the job to run
as and let it worry about where the file goes. It uses whatever is in
the environment (shell) variable EDITOR.
HTH,
Jeffrey
Quoting tabanna
My idea was to automate some back-up jobs.
I went to directory /var/cron/tabs and there created a new file <rootcron>
Firstly, I have the command :- < crontab -l >rootcron > next, I editied rootcron to tell it when to do what. Finally I gave the command < crontab rootcron >
This had the result, to write the instructions in /var/cron/tabs/root
BUT, the appointed hour came and went . . . Nothing happened :(
Any clues what I should have done ?
Thanks -- ____________ sent on Linux ____________
___________________________________________________________________________ Message envoye depuis iFrance : http://www.ifrance.com ou 3615 IFRANCE Gratuit : Hebergement (50 Mo)/Vos emails (POP,HTML,20 Mo, FAX)/Votre agenda
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
On Wed, 12 Jan 2000, Jeffrey L . Taylor wrote:
I just run "crontab -e" (e for edit) as the user I want the job to run as and let it worry about where the file goes. It uses whatever is in the environment (shell) variable EDITOR.
SYNTAX seems to be at the heart of the problem. I want to back-up my /etc Directory in a File named "etc" to which I wish to add the date of each day, so that the file-name will be like "etc000113.tar.gz" my ROOTCRON line looks like this :- 5 0 * * * tar czvf /etc`date +%y%m%d`.tar.gz /etc { SYNTAX is WRONG.} After standing on my head, and doing a double sommersault, I can not understand the 'man'or 'info' pages for "date" ! Could someone kindly tell me where I am going wrong with the ````````` marks ? thanks ____________ sent on Linux ____________ ___________________________________________________________________________ Message envoye depuis iFrance : http://www.ifrance.com ou 3615 IFRANCE Gratuit : Hebergement (50 Mo)/Vos emails (POP,HTML,20 Mo, FAX)/Votre agenda -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
Hi tabanna! On Thu, 13 Jan 2000, tabanna wrote:
On Wed, 12 Jan 2000, Jeffrey L . Taylor wrote:
I just run "crontab -e" (e for edit) as the user I want the job to run as and let it worry about where the file goes. It uses whatever is in the environment (shell) variable EDITOR.
SYNTAX seems to be at the heart of the problem.
I want to back-up my /etc Directory in a File named "etc" to which I wish to add the date of each day, so that the file-name will be like "etc000113.tar.gz"
my ROOTCRON line looks like this :-
5 0 * * * tar czvf /etc`date +%y%m%d`.tar.gz /etc { SYNTAX is WRONG.}
After standing on my head, and doing a double sommersault, I can not understand the 'man'or 'info' pages for "date" !
Could someone kindly tell me where I am going wrong with the ````````` marks ?
I ran it here and it works fine, try running it from the command line and see what is said. Also does your ROOTCRON point to a shell. Sean -- GPG ID (DSA) 92B9D0CF PGP2 ID 19592A0D Linux User: #124682 ICQ: 679813 To get my PGP Keys send me an empty email with retrieve as the subject My Current Uptime is 4d, 11h and 0m on Linux 2.2.14 ...It said "Needs Windows 95 or better". So I installed Linux... -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
On Thu, 13 Jan 2000, Sean Rima wrote: ___________________________________________ 5 0 * * * tar czvf /etc`date +%y%m%d`.tar.gz /etc { SYNTAX is WRONG.} ___________________________________________
I ran it here and it works fine, try running it from the command line and see what is said. Also does your ROOTCRON point to a shell.
Strike me pink ! ~ Yes, I just tried as you suggest, and it DOES run OK at the command line ! So, How must I Point rootcron to a shell, so that the CRON job is executed OK ? Thanks, Sean :) best ____________ sent on Linux ____________ ___________________________________________________________________________ Message envoye depuis iFrance : http://www.ifrance.com ou 3615 IFRANCE Gratuit : Hebergement (50 Mo)/Vos emails (POP,HTML,20 Mo, FAX)/Votre agenda -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
Hi tabanna! I had the same problem, nearly killed me :) Add to the top of your crontab -e: SHELL=/bin/sh Let us know if that helps. Sean On Thu, 13 Jan 2000, tabanna wrote:
On Thu, 13 Jan 2000, Sean Rima wrote: ___________________________________________ 5 0 * * * tar czvf /etc`date +%y%m%d`.tar.gz /etc { SYNTAX is WRONG.} ___________________________________________
I ran it here and it works fine, try running it from the command line and see what is said. Also does your ROOTCRON point to a shell.
Strike me pink ! ~ Yes, I just tried as you suggest, and it DOES run OK at the command line !
So, How must I Point rootcron to a shell, so that the CRON job is executed OK ?
Thanks, Sean :)
best
____________ sent on Linux ____________
___________________________________________________________________________ Message envoye depuis iFrance : http://www.ifrance.com ou 3615 IFRANCE Gratuit : Hebergement (50 Mo)/Vos emails (POP,HTML,20 Mo, FAX)/Votre agenda
Sean -- GPG ID (DSA) 92B9D0CF PGP2 ID 19592A0D Linux User: #124682 ICQ: 679813 To get my PGP Keys send me an empty email with retrieve as the subject My Current Uptime is 4d, 12h and 34m on Linux 2.2.14 ...Generated by Uptimer - http://www.tcob1.uklinux.net -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
On Thu, 13 Jan 2000, Sean Rima wrote:
I had the same problem, nearly killed me :) Add to the top of your crontab -e: SHELL=/bin/sh
Thanks Sean . . . I'm not quite there yet . . .
SO, it DOES run from the Command Line,
AND, I have now added SHELL=/bin/sh at the head of ROOTCRON
But . . .
---
my rootcron file, in /var/cron/tabs/ now is as follows :-
________________________
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (root installed on Thu Jan 13 15:37:06 2000)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
SHELL=/bin/sh
39 15 * * * tar czvf /bup/etc`date +%y%m%d`.tar.gz /etc /root /boot
41 15 * * * tar czvf /bup/home`date +%y%m%d`.tar.gz /home
43 15 * * * tar czvf /bup/var`date +%y%m%d`.tar.gz /var/named /var/cron/tabs /var/spool/mail /usr/X11R6/lib/X11/app-defaults /usr/X11R6/lib/X11/fonts/greek
45 15 * * * updatedb
_____________________
The error message I get in /var/spool/mail/root is :-
_________________________________________
Subject: Cron
On Thu, 13 Jan 2000, tabanna wrote:
SO, it DOES run from the Command Line, AND, I have now added SHELL=/bin/sh at the head of ROOTCRON
But . . .
What might be fouling things up ?
I don't know--perhaps cron doesn't parse the line correctly or interprets quotes differently from the shell? I do know what'll fix it. Just create a shell script for the command and run _that_ from cron. ----- begin script ----- #!/bin/sh exec tar czvf /bup/etc`date +%y%m%d`.tar.gz /etc /root /boot ----- end script ------- If _that_ doesn't work, your cron isn't working properly! -- Ron Oliver (mailto:roliver-suse@quantum-networks.com) -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
On Thu, 13 Jan 2000, Ron Oliver wrote:
I do know what'll fix it. Just create a shell script for the command and run _that_ from cron.
That DID fix it ! Many thanks to you, and to Sean Rina for your help. best :) ____________ sent on Linux ____________ ___________________________________________________________________________ Message envoye depuis iFrance : http://www.ifrance.com ou 3615 IFRANCE Gratuit : Hebergement (50 Mo)/Vos emails (POP,HTML,20 Mo, FAX)/Votre agenda -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
Hi tabanna! On Thu, 13 Jan 2000, tabanna wrote:
On Thu, 13 Jan 2000, Sean Rima wrote:
I had the same problem, nearly killed me :) Add to the top of your crontab -e: SHELL=/bin/sh
Thanks Sean . . . I'm not quite there yet . . . SO, it DOES run from the Command Line, AND, I have now added SHELL=/bin/sh at the head of ROOTCRON
But . . . --- my rootcron file, in /var/cron/tabs/ now is as follows :- ________________________
# DO NOT EDIT THIS FILE - edit the master and reinstall. # (root installed on Thu Jan 13 15:37:06 2000) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) SHELL=/bin/sh 39 15 * * * tar czvf /bup/etc`date +%y%m%d`.tar.gz /etc /root /boot 41 15 * * * tar czvf /bup/home`date +%y%m%d`.tar.gz /home 43 15 * * * tar czvf /bup/var`date +%y%m%d`.tar.gz /var/named /var/cron/tabs /var/spool/mail /usr/X11R6/lib/X11/app-defaults /usr/X11R6/lib/X11/fonts/greek 45 15 * * * updatedb _____________________
The error message I get in /var/spool/mail/root is :- _________________________________________
Subject: Cron
tar czvf /bup/var`date + X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: /bin/sh: -c: line 1: unexpected EOF while looking for matching ``' /bin/sh: -c: line 2: syntax error: unexpected end of file _____________________________________________
What might be fouling things up ?
Cron is trying to change %d to a argv arguement. What I would suggest is having a couple of files like: #!/bin/sh #Backs up /etc /root/ /boot #Name: etcroot-backup tar czvf /bup/etc`date +%y%m%d`.tar.gz /etc /root /boot do a chmod a+x etcroot-backup on it and Cron it as: 39 15 * * * <path-to>/etcroot-backup And that should work Sean -- GPG ID (DSA) 92B9D0CF PGP2 ID 19592A0D Linux User: #124682 ICQ: 679813 To get my PGP Keys send me an empty email with retrieve as the subject My Current Uptime is 4d, 15h and 8m on Linux 2.2.14 ...Generated by Uptimer - http://www.tcob1.uklinux.net -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
tabanna wrote:
On Wed, 12 Jan 2000, Jeffrey L . Taylor wrote:
I just run "crontab -e" (e for edit) as the user I want the job to run as and let it worry about where the file goes. It uses whatever is in the environment (shell) variable EDITOR.
SYNTAX seems to be at the heart of the problem.
I want to back-up my /etc Directory in a File named "etc" to which I wish to add the date of each day, so that the file-name will be like "etc000113.tar.gz"
my ROOTCRON line looks like this :-
5 0 * * * tar czvf /etc`date +%y%m%d`.tar.gz /etc { SYNTAX is WRONG.}
After standing on my head, and doing a double sommersault, I can not understand the 'man'or 'info' pages for "date" !
Could someone kindly tell me where I am going wrong with the ````````` marks ?
You have been bitten by one of cron's features. To quote the crontab(5) man page: The ``sixth'' field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh or by the shell specified in the SHELL variable of the cronfile. Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input. /Michael -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
participants (6)
-
andrew@andrew.dabsol.co.uk
-
Michael.Salmon@uab.ericsson.se
-
muskrat@texas.net
-
roliver-suse@quantum-networks.com
-
tabanna@ifrance.com
-
thecivvie@mailandnews.com