Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: Cron problems

  • Subject: Re: Cron problems
  • From: Roy Schestowitz <newsgroups@schestowitz.com>
  • Date: Fri, 04 Mar 2005 03:49:06 +0000
  • Newsgroups: uk.comp.os.linux
  • References: <cvu763$2vlt$1@godfrey.mcc.ac.uk> <1125pf6hv0chme4@corp.supernews.com> <cvv8qi$1692$1@godfrey.mcc.ac.uk> <112ep2vo3t48k35@corp.supernews.com>
  • User-agent: KNode/0.7.2
"Ian" <spam"AT"bathfordhill.co.uk> wrote:

> 
> "Roy Schestowitz" <newsgroups@schestowitz.com> wrote in message
> news:cvv8qi$1692$1@godfrey.mcc.ac.uk...
>> "Ian" <spam"AT"bathfordhill.co.uk> wrote:
>>
>> >
>> > "Roy Schestowitz" <newsgroups@schestowitz.com> wrote in message
>> > news:cvu763$2vlt$1@godfrey.mcc.ac.uk...
>> >> I have been struggling to set up a nightly job that backs up a portion
> of
>> > my
>> >> files. The following is a snippet from my crontab:
>> >>
>> >> ---
>> >> SHELL=/bin/sh
>> >> PATH=/usr/local/bin:/bin:/usr/bin
>> >>
>> >> 28 4 * * * tar czvf /home/roy/Main/Transfer_Archives/rss-`date
>> >> +%Y-%m-%d`.tar.gz /home/roy/Main/Transfer
>> >> ---
>> >>
>> >> When I check the status of the task, I observe the following error:
>> >>
>> >> ---
>> >> /bin/sh: -c: line 1: unexpected EOF while looking for matching ``'
>> >> /bin/sh: -c: line 2: syntax error: unexpected end of file
>> >> ---
>> >>
>> >> The command, however, works /fine/ when run normally in the shell.
>> > Removing
>> >> `date +%Y-%m-%d` resolves the error, but does not help me do what I
>> > want --
>> >> it overwrites an older file.
>> >>
>> >> Any help appreciated,
>> >>
>> >> Roy
>> >>
>> >> --
>> >> Roy Schestowitz
>> >> http://schestowitz.com
>> >
>> > Hi
>> > Got to admit     i had similar problems when running the following cron
> job
>> > as root
>> >
>> > mv /var/log/asterisk/cdr-csv/Master.csv /var/cdr-rec/cdr/`date
>> > +%a%b%d%g -d yesterday` -f
>> >
>> > Its now part of a larger job thats in my cron.daily directory and is
>> > faultless... I know it doesnt help but if your distro has cron
> directories
>> > try adding the script file in there..
>> >
>> > Ian
>>
>> Could it possibly have anything to do with line wrapping? I checked again
>> and again but no luck...
>>
>> This would also explain that line of yours which appears to spill over to
> a
>> second line without closing the apostrophe...
>>
>> I'll have another look. Thanks Ian.
>>
>> Roy
>>
>> --
>> Roy Schestowitz
>> http://schestowitz.com
> Hi Roy
> 
> Mine dosnt spill over in the actual file. its all one line.
> Personaly I only use vi or vim for editing so I never have to worry about
> line feeds.
> 
> Not sure what you used but does the LF show up when your more the file ?
> if it does it shouldnt
> Ian

Ian

I guess I neglected to mention how I got around the problem. I simply put
the command which I knew worked for me in command-line and turned it into a
batch file (called 'tar_files'):

tar czvf /home/roy/Main/Transfer_Archives/www-`date +%Y-%m-%d`.tar.gz
/home/roy/Main/Transfer_Archives/Sites
tar czvf /home/roy/Main/Transfer_Archives/rss-`date +%Y-%m-%d`.tar.gz
/home/roy/Main/Transfer

I then of course set its permissions to 755 and set up a cron job that runs
this file:

20 00 * * * /home/roy/Main/Transfer_Archives/tar_files

I am now a happy man.

Roy

-- 
Roy Schestowitz
http://schestowitz.com

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index