Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
shazwanpacat
Participant
Jump to solution

MDSENV command not found via shell script but works on terminal

Hi,

Right now I'm working with MDS R77.10 and in the middle of creating mini script (pushpolicy.sh) to automate install policy via cli as per below example. (Currently not pushing via GUI because of timeout issue)

#!/bin/bash

mdsenv 172.16.1.1
fwm load POLICY_10082020 FW_CLUSTER0001

 and then chmod the script as well.

chmod +x pushpolicy.sh

  But when I execute the script, below error will come up.

[Expert@firewallmds01]#./pushpolicy.sh
./pushpolicy.sh: line 3: mdsenv: command not found
[Expert@firewallmds01]#

From my reading, it may related to environment PATH, but still can't figure it out.

How can I overcome this issue? Or any better way to automate this process?

I just want to make this process easier to use by anyone in my team regardless of their linux knowledge.

0 Kudos
1 Solution

Accepted Solutions
Danny
Champion Champion
Champion

Just add 

source /etc/profile.d/CP.sh;‍‍

right after your #!/bin/bash header.

View solution in original post

8 Replies
_Val_
Admin
Admin

why not putting the absolute path? or, alternatively, use "# !/bin/sh" at the beginning 🙂

shazwanpacat
Participant

Thanks for the prompt reply.

Sorry but I'm still not familiar with mds cli environment. for this case, what is the absolute path for 'mdsenv <domain ip>'?

Tried the "# !/bin/sh" but no luck.

0 Kudos
_Val_
Admin
Admin

mdsenv is under $MDSDIR/bin/, which can be resolved to different actual paths, depending on the version.

0 Kudos
Hugo_vd_Kooij
Advisor

Absolute paths are always a bad thing.

I had to cleanup too many messes because someone did put in a hard path that failed after an upgrade.

 

<< We make miracles happen while you wait. The impossible jobs take just a wee bit longer. >>
0 Kudos
Danny
Champion Champion
Champion

Just add 

source /etc/profile.d/CP.sh;‍‍

right after your #!/bin/bash header.

shazwanpacat
Participant

This one works! 

Thanks sir!

0 Kudos
shazwanpacat
Participant

Thanks Danny.

 

It works perfectly!

0 Kudos
_Val_
Admin
Admin

Good catch, @Danny, did not think of that 🙄

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events