LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 10-19-2009, 09:59 AM   #1
bryanvick
LQ Newbie
 
Registered: Oct 2009
Posts: 15

Rep: Reputation: 0
Works manually, but not w/ cron, quotation problem


When I run this command manually at the bash command line, it works. But when I stick it in my crontab, I get this error each time it runs:

Command
-------
sudo rdiff-backup --print-statistics --exclude-globbing-filelist /home/bry/backup/vic/exclude --remote-schema 'ssh -C -i /home/bry/.ssh/id_rsa %s rdiff-backup --server' root@myip.net::/home /home/bry/backup/vic/home

Error from cron
---------------
/bin/sh: Syntax error: Unterminated quoted string

Any ideas?
 
Old 10-19-2009, 10:09 AM   #2
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
I'm not sure it would work, but have you tried using " characters instead of ' characters, like so?:*

sudo rdiff-backup --print-statistics --exclude-globbing-filelist /home/bry/backup/vic/exclude --remote-schema "ssh -C -i /home/bry/.ssh/id_rsa %s rdiff-backup --server" root@myip.net::/home /home/bry/backup/vic/home

John G



* I have no idea what the hell the proper way to punctuate that is. Especially with the asterisk there for this.

Last edited by JohnGraham; 10-19-2009 at 10:12 AM.
 
Old 10-20-2009, 10:08 AM   #3
bryanvick
LQ Newbie
 
Registered: Oct 2009
Posts: 15

Original Poster
Rep: Reputation: 0
I changed ' to ". That did not work.
 
Old 10-20-2009, 10:29 AM   #4
New2Linux2
Member
 
Registered: Jan 2004
Location: Arizona
Distribution: Debian
Posts: 153

Rep: Reputation: 43
How about using ` instead of '?
 
Old 10-20-2009, 10:29 AM   #5
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Crontab has a limited shell, so try to use the absolute path to all commands.
 
Old 10-21-2009, 12:39 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,863

Rep: Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598
Also, just put that cmd into a script and call it. Keep cron cmds (ie crontab entries) as simple as possible.

PS If you copy-n-pasted that, you more than likely got a <cr> in the middle.
 
Old 10-21-2009, 10:00 AM   #7
bryanvick
LQ Newbie
 
Registered: Oct 2009
Posts: 15

Original Poster
Rep: Reputation: 0
From a user on the rdiff-backup mailing list:

Per "man 5 crontab":

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 new-line characters, and all data after the first %
will be sent to the command as standard input.

So the % was causing the problem. I escaped it and it seems to be working now.

I'm also going to move my cron commands to scripts as suggested to keep things clean. Thanks for everyone's help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can not input double quotation marks(invalid quotation key) wangzhilife Linux - Hardware 2 09-18-2009 06:44 AM
cron job doesnt work, it works manually scofiled83 Programming 8 05-30-2009 03:12 PM
Script works when run manually but not in cron job Harlin Linux - Software 7 10-16-2007 06:36 PM
Problem: LIRC does not activate on reboot, but works manually mr_r Linux - Software 1 03-19-2006 07:31 AM
Manually editing cron inpt Linux - Software 5 12-02-2004 03:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration