Hi

I'm having trouble with finding out how the ssh script is interpreted in combination with the "PA_" actions.

So far I have success in making the following work:

TEST='systemctl status licenseserver.service | grep -q "active (running)"'
 echo "PA_Details($TEST)"

As expected I get "active (running)" in the response.

Now I want to do some more scripting commands. F.ex:

TEST='systemctl status licenseserver.service | grep -q "active (running)"'
LENGTH=${#TEST}
echo "PA_Details($LENGTH)"

This however returns:

Details variable holds:
root@lvps83-169-42-89:~# exit
logout

Why don't I get the length of the string?

I have also experimenting with:

#!/bin/bash
TEST='test string'
 echo "PA_Details($TEST)"

This also gives me:

Details variable holds:
root@lvps83-169-42-89:~# exit
logout

I really can't figure out what is going on.

Best, Rune

asked 24 Mar, 07:49

run66's gravatar image

run66
100411
accept rate: 14%


I didn't solve all but enough.

The script I got working looks like this:

#!/bin/bash
TEST=$(systemctl status licenseserver.service | grep "active (running)")
LENGTH=${#TEST}
NOTRUNNING=false
if (($LENGTH>0)) ; then
   NOTRUNNING=false
else
   NOTRUNNING=true
fi
echo "PA_FireActions($NOTRUNNING)"

Also bash variables in PA_Details should be enclosed in quotes:

 echo "PA_Details(\"$TEST\")"
link

answered 25 Mar, 05:06

run66's gravatar image

run66
100411
accept rate: 14%

edited 25 Mar, 05:06

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×13
×4

Asked: 24 Mar, 07:49

Seen: 158 times

Last updated: 25 Mar, 05:06