Hi everybody,
Lately, I have been experimenting with writting customized backup scripts via the `Backup Command`attribute within the client resource.
The environment of the NetWorker server in question is Windows 2000, so I started writing a Batch Dos script but soon realized that this script language is not sophisticated enough for what I wanted to do (Command execution, filtering of arguments, etc...).
So being familiar with UNIX scripting, I installed MKS Toolkit and developed a Korn Shell script that worked fine on the Dos command line. To make it work via NetWorker, I needed a Batch wrapper script to call my Korn Shell script because the nwadmin GUI did not let me enter "sh nsr_save_custom.ksh" in the "Backup Command" attribute in the client ressource. But anyway, it worked. Within the script, I used the "$@" argument on the save command (e.g. save "$@") which put all the input arguments within quotes. So everything was fine until that point. But then I was told that I should not use Korn Shell but Perl...
So, I installed Active Perl and wrote a perl version of my customized save script. It worked fine when I ran it from the Dos command line but did work at all when I tried to call from my Batch wrapper script because the input arguments supplied to the the Perl script were not between quotes... Some arguments (-g) contained spaces.
E.g.
save -s nc1981leg01 -g Test Vincent -LL -m nc1981leg01 -l full -q -W 78 -N c:\toto.txt c:\toto.txt
So my question is: is there an easy way so that the arguments are quoted properly upon entry to the perl script? I know that I can do this in my Perl script but I rather use something functionally equivalent to the "$@" variable that I used within the Korn Shell version of the script.
Any suggestions are welcomed.
Lately, I have been experimenting with writting customized backup scripts via the `Backup Command`attribute within the client resource.
The environment of the NetWorker server in question is Windows 2000, so I started writing a Batch Dos script but soon realized that this script language is not sophisticated enough for what I wanted to do (Command execution, filtering of arguments, etc...).
So being familiar with UNIX scripting, I installed MKS Toolkit and developed a Korn Shell script that worked fine on the Dos command line. To make it work via NetWorker, I needed a Batch wrapper script to call my Korn Shell script because the nwadmin GUI did not let me enter "sh nsr_save_custom.ksh" in the "Backup Command" attribute in the client ressource. But anyway, it worked. Within the script, I used the "$@" argument on the save command (e.g. save "$@") which put all the input arguments within quotes. So everything was fine until that point. But then I was told that I should not use Korn Shell but Perl...
So, I installed Active Perl and wrote a perl version of my customized save script. It worked fine when I ran it from the Dos command line but did work at all when I tried to call from my Batch wrapper script because the input arguments supplied to the the Perl script were not between quotes... Some arguments (-g) contained spaces.
E.g.
save -s nc1981leg01 -g Test Vincent -LL -m nc1981leg01 -l full -q -W 78 -N c:\toto.txt c:\toto.txt
So my question is: is there an easy way so that the arguments are quoted properly upon entry to the perl script? I know that I can do this in my Perl script but I rather use something functionally equivalent to the "$@" variable that I used within the Korn Shell version of the script.
Any suggestions are welcomed.