ADSM-L

Re: Commands

2001-02-28 18:54:59
Subject: Re: Commands
From: "Canzler, Eric" <eric.canzler AT ATTWS DOT COM>
Date: Wed, 28 Feb 2001 15:40:22 -0800
I do it something like this:

dsmadmc -server=adsm1 -id=admin1 -pa=goober -comma q drmedia \* wherest=mo >
/tmp/dsmquery.out

That's all one long Unix command line and the backslash is there to escape
the asterisk so the shell won't do odd things with it. For perl scripts
I use something like the following:


#!/usr/local/bin/perl

$userid="admin1";
$userpw="goober";
$command = 'q drmedia \* wherest=mo';

$dsmoutput = &dsmc_cmd($command);

open(TEST, ">/tmp/dsmquery.out");
print TEST $dsmoutput;
close(TEST);



sub dsmc_cmd {

    my($command) = @_;
    my($results);

    $results = `/usr/bin/dsmadmc -server=adsm2 -id=$userid -pa=$userpw
-comma $command`;
    return($results);
    return($results);
}

# END OF FILE


With that kind of perl script you can have several commands and pass them
to the dsmc_cmd function with output to different files or appended to the
same file and do other perl processing before writing the file or after
writing, so its pretty flexible. It may not be the best way but it works
well enough for me. The -comma option give you csv output which helps
parsing with perl and awk.


-- Eric Canzler
-- Unix System Administrator
-- Unix System Administrator
-- eric.canzler AT attws DOT com
-- eric.canzler AT attws DOT com
> -----Original Message-----
> -----Original Message-----
> From: Gill, Geoffrey L. [SMTP:GEOFFREY.L.GILL AT SAIC DOT COM]
> Sent: Wednesday, February 28, 2001 2:39 PM
> To:   ADSM-L AT VM.MARIST DOT EDU
> Subject:      Commands
>
> I've been dabbling in trying to get the output of a command, through the
> scheduler, to run and send the output to a file, either on the TSM server
> or
> another computer. That file will be ftp'd to another computer and
> deciphered
> there. I've been able to run the command from a TSM admin command prompt
> on
> my computer but not through a command I made and put in a server command
> script I can run through the scheduler. I'm not a programmer for sure so I
> need some help. This can either be a select statement or query command as
> long as I get a text output file. Here is what works from a dsmc command
> prompt:
>
> adsm> query drmedia  * wherestate=mo > \\servername\temp\drmmo.txt
>
> I tried to run the command from the command line on the web browser and a
> server command script but get this output:
> ANR2020E QUERY DRMEDIA: Invalid parameter - >.
>
>
> I tried to run the command to redirect to the adsm server but it looks
> like
> I don't have the syntax right because I haven't been able to do that
> either.
> Unable to upen file blah blah blah for redirection.
>
> If someone can help with this I'd truly appreciate it. Sorry I can't offer
> prizes like Kelly can.
>
> Geoff Gill
> NT Systems Support Engineer
> SAIC
> Computer Systems Group
> E-Mail:   gillg AT saic DOT com
> Phone:  (858) 826-4062
> Pager:   (888) 997-9614
<Prev in Thread] Current Thread [Next in Thread>
  • Commands, Gill, Geoffrey L.
    • Re: Commands, Canzler, Eric <=