Article 4THKV works from command line - not from cron

works from command line - not from cron

by
djk44883
from LinuxQuestions.org on (#4THKV)
I have a shell script to export shows from my DVR. Seems to work when from from the command line. I create a job in /etc/cron.d and it runs... but misses shows with apostrophe. Note: I run the job as "me" I am added to crontab group.

snip from cron email:
Code:X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=dj>
X-Cron-Env: <HOME=/home/dj>
X-Cron-Env: <LOGNAME=dj>notorious lines as reported in the cron email report, note script has set -x
Code:+ export_namechange wrapto1 'The People'\''s Court' PeoplesCourt /media/dvr
+ wrapto1 --name 'The People'\''s Court' --filename 'PeoplesCourt - s%se%e.mp4' --get --all --capto-args '-p /media/dvr -a -q'
Finished 0 jobs in 0 sec: 0 files transferred OK, 0 files failed.The 2nd and 3rd lines are actually from another script named export_namechange. It passes which device 1 or 2 the name of the show new name and path. Line as it appears in TabloDaily
Code:exportnamechange 1 "The People's Court" PeoplesCourt /media/dvrI have the entire name double quoted, and it escapes the ' as I guess it does. So I try "The People\'s Court" and "The People"\'s" Court" and then I just get 2 back slashes or even more single quote around it all to keep the backslash. -wtf

Now the real screwy part... From the command line

Code:+ export_namechange wrapto1 'The People'\''s Court' PeoplesCourt /media/dvr
+ wrapto1 --name 'The People'\''s Court' --filename 'PeoplesCourt - s%se%e.mp4' --get --all --capto-args '-p /media/dvr -a -q'
Retrieving item '178906' via command 'capto1 -e 178906 -p /media/dvr -a -q -f "PeoplesCourt - s23e35.mp4"'
Retrieved '178906' OK
Finished 1 job in 239 sec: 1 file transferred OK, 0 files failed.It passes things on with the messed up escaping still, but what ever is going on differently it catches the show and exports it. Now what's different about running from cron? It's not the explicitly added '\' which I can't seem to get rid of. I try to escape it from inside the double quotes, seems to still want to make it literal.

/etc/cron.d/TabloDaily
Code:SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=dj
#
59 23 * * * dj /usr/local/sbin/TabloDailyAgain, the report shows it's run and loged on as me [dj] with my home environment, but .bashrc exits if not interactive - no shopt other than histappend and checkwinsize any ways.

All scripts start with
Code:#!/bin/bash
set -xlatest?d=yIl2AUoC8zA latest?i=q07aRI8cH-0:4NU7E_B3wQ0:F7zBnMy latest?i=q07aRI8cH-0:4NU7E_B3wQ0:V_sGLiP latest?d=qj6IDK7rITs latest?i=q07aRI8cH-0:4NU7E_B3wQ0:gIN9vFwq07aRI8cH-0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments