Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
03-02-2013, 09:00 PM
|
#1
|
|
Member
Registered: Nov 2005
Location: East Coast, USA
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 338
Rep:
|
svnadmin crontab issue
Just checked last year's source code backups and to my shock there weren't any! When I ssh'd into the subversion server I had 52 new mail messages!
Code:
/bin/sh: 1: Syntax error: end of file unexpected (expecting ")")
Looking at the crontab:
Code:
00 1 * * 1 svnadmin dump /home/svn/collection | gzip > /media/remote/Backup/svnserver01/$(date +%Y-%m-%dT%H:%M).backup.svn.gz
I ran the command directly in the terminal and it worked fine. What's wrong with running this command in a user crontab?
|
|
|
|
03-02-2013, 11:45 PM
|
#2
|
|
Member
Registered: Sep 2011
Posts: 156
Rep: 
|
Perhaps changing to this would do it:
Code:
00 1 * * 1 svnadmin dump /home/svn/collection | gzip > /media/remote/Backup/svnserver01/`date +%Y-%m-%dT%H:%M`.backup.svn.gz
|
|
|
|
03-04-2013, 01:13 AM
|
#3
|
|
Guru
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 15,000
|
Could be the fact that the default PATH in cron is minimal. Always recommended to specify absolute path to all cmds/files used or (better) put the whole thing in a script, call that and source/specify required PATH.
EG start by cd'ing into your dir, then copy PATH definition from your env.
|
|
|
|
03-04-2013, 02:28 AM
|
#4
|
|
Member
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,OpenBSD
Posts: 498
Rep: 
|
I'm shocked it took longer than a week to notice this .. stuff that hasn't been tested should be assumed not to work.
|
|
|
|
03-04-2013, 02:32 AM
|
#5
|
|
Moderator
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.4 OpenSuSE 12.2
Posts: 9,897
|
The real problem is that % signs need to be escaped, since they have a special meaning in crontab. The % signs in crontab will be changed to newline and everything after the first % sign is interpreted as standard input to the command. Therefore you crontab entry will result in:
Code:
00 1 * * 1 svnadmin dump /home/svn/collection | gzip > /media/remote/Backup/svnserver01/$(date +
Y-
m-
dT
H:
M).backup.svn.gz
and the parenthesis highlighted in red is responsible of the error. You should change the date command into:
Code:
date +\%Y\%m\%dT\%H:\%M
Hope this helps.
|
|
|
3 members found this post helpful.
|
03-04-2013, 07:53 AM
|
#6
|
|
Member
Registered: Nov 2005
Location: East Coast, USA
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 338
Original Poster
Rep:
|
Quote:
Originally Posted by linosaurusroot
I'm shocked it took longer than a week to notice this .. stuff that hasn't been tested should be assumed not to work.
|
Ha... yea, it took 52 weeks; and even then I only noticed it because I was performing and annual backups audit. I guess it's a good thing that Subversion server didn't go down this year.
|
|
|
|
03-04-2013, 08:07 AM
|
#7
|
|
Member
Registered: Nov 2005
Location: East Coast, USA
Distribution: Fedora 18, Slackware64 13.37, Windows 7/8
Posts: 338
Original Poster
Rep:
|
Quote:
Originally Posted by colucix
You should change the date command into:
Code:
date +\%Y\%m\%dT\%H:\%M
Hope this helps.
|
Makes sense! I'll know tomorrow morning if it worked or not. Thanks!
----------UPDATE-----------
Yup, that works. I wonder why characters have to be escaped in a crontab definition but not in a standard bash script? Is it because cron doesn't use /bin/sh to run?
Last edited by thund3rstruck; 03-05-2013 at 08:51 AM.
Reason: Update
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
|
One issue with Crontab
|
abhitanshu |
Linux - Server |
3 |
09-24-2012 02:34 PM |
|
[SOLVED] Crontab issue
|
pinga123 |
Linux - General |
2 |
03-17-2011 01:56 AM |
|
web svnadmin
|
izghitu |
Linux - Software |
0 |
04-23-2010 05:25 AM |
|
[SOLVED] Crontab Issue
|
shii_va |
Linux - Server |
2 |
09-15-2009 11:30 AM |
|
crontab issue
|
adnanm |
Linux - Newbie |
1 |
03-16-2007 02:28 AM |
All times are GMT -5. The time now is 10:17 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|