VMware Cloud Community
dwchan
Enthusiast
Enthusiast

how to insert quote and "`" into my cron job.

I am trying to insert this in my a new cron.weekly job. It is in my post that i try to create a new file inside my /etc/cron.weekly/vdfhtml, the problem is that i am having issue with the the quote and "`" character. I try echo, but that didn't work, i also try <</eof, but it woulnd't process my $sendTo variable. Does anyone have any idea? here is what I have try and fail!

cat >> /etc/cron.weekly/vdfhtml<<\EOF5

/usr/local/bin/vdfhtml.sh

/usr/sbin/esxcfg-firewall -o 25,tcp,out,SMTP

/usr/local/bin/smtp_send.pl -t $SendTo -s "VMware Weekly Disk Space Status..." -f -m "`cat /var/log/vdf.html`" -r $SMTPSrv

EOF5

echo "/usr/local/bin/smtp_send.pl -t $SendTo -s "VMware Weekly Disk Space Status..." -f -m ""`cat /var/log/vdf.html`"" -r $SMTPSrv" >> /etc/cron.weekly/vdfhtml

0 Kudos
1 Reply
Schorschi
Expert
Expert

You are trying to do an 'escaped' string in the command line for the cron task. Better solution is to create a bash script that the cron daemon executes.

0 Kudos