ADSM-L

Re: [ADSM-L] schedulde command with date suffixed log file

2014-03-31 12:18:32
Subject: Re: [ADSM-L] schedulde command with date suffixed log file
From: David Bronder <david-bronder AT UIOWA DOT EDU>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Mon, 31 Mar 2014 11:15:59 -0500
On 03/31/2014 09:27 AM, PAC Brion Arnaud wrote:
>
> A quick one: does anyone have the proper syntax to define a client schedule 
> (using admin command line, or macro) that would execute a command having some 
> date-suffixed log file, like :
>
> def sched aix test_sched  act=command  objects="/tmp/test.sh >/tmp/test.log. 
> `date '+%d.%m.%Y'` 2>&1" durunits=minutes duration=10 startt=now peru=o 
> priority=1
>
> TSM server is 6.3.3.1 and runs under AIX .
>
> I already have tried various combinations of single and double quotes without 
> success  ...

First, if you included the objects string verbatim, you have an extra space
between "test.log." and the date subshell.

Generally, the most reliable method would be to wrap the entire client
command in a simple shell script on the client.  Then the TSM client just
executes the wrapper and the wrapper handles the shell metacharacters
(redirection, subshell date, etc.).

If that's not an option, you could try something like this:

  ... objects="/usr/bin/sh -c '/tmp/test.sh >/tmp/test.log.`date +%d.%m.%Y`
2>&1'" ...

The extra quotes around the argument to date aren't usually necessary unless
something else is evaluating the % characters before date gets them.  With
POSIX-compliant shells, including modern sh/ksh, you can also use $(...)
instead of `...` for subshells (may not make a difference here, but can be a
useful tool in the shell arsenal).

=Dave

--
Hello World.                                David Bronder - Systems Architect
Segmentation Fault                                      ITS-EI, Univ. of Iowa
Core dumped, disk trashed, quota filled, soda warm.   david-bronder AT uiowa 
DOT edu

<Prev in Thread] Current Thread [Next in Thread>