Execute command using ssh server 'cmd'

Hi
The command below does not work as it require to take command in the breakers
But If I do so the variable values get lost

ssh testserver01 'dsmc q b "${ARCHIVE_DIR}*" -sub=yes -querysummary -inactive -fromd="${BACKUP_DATE}"'

Thank you.

I'm not familiar with the dmsc utility, but I assume you want something like:

ssh testserver01 dsmc q b '${ARCHIVE_DIR}*' -sub=yes -querysummary -inactive -fromd='${BACKUP_DATE}'

assuming that you want $ARCHIVE_DIR and $BACKUP_DATE to be expanded on testserver01 rather than being expanded on the local machine and sending the expanded strings to be processed on testserver01. If you want the variables to be expanded on the local machine, change the single quotes above to double quotes. If you want the variables to be expanded on the local machine, but the expanded results need to be quoted on the remote machine, try:

ssh testserver01 dsmc q b "\"${ARCHIVE_DIR}*\"" -sub=yes -querysummary -inactive -fromd="\"${BACKUP_DATE}\""

You haven't given us any indication of how these variables would be set in either environment.

That is the client program of the TSM (Tivoli Storage Manager), IBMs Enterprise backup suite.

This is perhaps the case. From the commands given to dsmc ("q"="query") this is most probably a (site-wide) test if the backup has been taken.

I hope this helps.

bakunin

Thanks you a lot!!!! Works just fine!