A question about variables

nnCron and nnCron LITE discussion

A question about variables

Postby wrybread » Tue, 14 Feb 2006, 23:39

I'm trying to use variables in my cron.tab file to keep it a little neater. Here's how I'm setting my variables:

SET source1="c:\docs"

This works great. But what if I have a phrase that I'd like to put in my variable that requires quotes? For example, I'd like to put this phrase into a variable:

-ax h -ax s -c -log \\192.168.1.240\share\backup_logs\backup_log_c.txt -v -ra "c:\python24\python.exe \\192.168.1.240\backups\scripts\post-backup_c.py"

Note the -ra (aka command executed after completion), where I need the full path to the python interpreter, followed by the script name. I've tried putting that into a variable, but it crashes cron every time. It works fine when I enter that manually, outside of a variable.

Here's what I've tried:

SET commands1="-ax h -ax s -c -log \\192.168.1.240\share\backup_logs\backup_log_c.txt -v -ra \"c:\python24\python.exe \\192.168.1.240\backups\scripts\post-backup_c.py\""

SET commands1="-ax h -ax s -c -log \\192.168.1.240\share\backup_logs\backup_log_c.txt -v -ra 'c:\python24\python.exe \\192.168.1.240\backups\scripts\post-backup_c.py'"

SET commands1="-ax h -ax s -c -log \\192.168.1.240\share\backup_logs\backup_log_c.txt -v -ra c:\python24\python.exe \\192.168.1.240\backups\scripts\post-backup_c.py"

None of the above work.

Is there a way to do this?
wrybread
 
Posts: 11
Joined: Tue, 14 Feb 2006, 23:31

Postby VK » Wed, 15 Feb 2006, 12:45

Try to use %QUOTE% predefined variable (described in nnCron docs in chapter 'nnCron Predefined Variables') when you need qoutes inside the other quotes. Smth like this:

SET commands1="-ax h -ax s -c -log \\192.168.1.240\share\backup_logs\backup_log_c.txt -v -ra %QUOTE%c:\python24\python.exe \\192.168.1.240\backups\scripts\post-backup_c.py%QUOTE%"

Don't forget, that you can store nnBackup startup parameters in a text file (described in nnBackup docs in chapter 'Storing Startup Parameters in a Text File')

HTH!
CU
VK
User avatar
VK
 
Posts: 680
Joined: Wed, 14 Jul 2004, 19:17


Return to nnCron forum (English)

Who is online

Users browsing this forum: No registered users and 1 guest