Archive > 16.7 Legacy Series

OPNSense CLI interface on Roadmap?

<< < (3/3)

jeje1307:

--- Quote ---I thought configctl firmware upgrade could be exactly what I am looking for. Could you explain why it return a 'cannot upgrade' error even though updates are available
--- End quote ---


--- Quote ---And one last question:
Is there a way to check whether ports are down/up and/or whether services are running/stopped through CLI, API or other?
--- End quote ---

I've got the exact same questions as noname.

Did anyone find the answer ?

jeje1307:

--- Quote ---And one last question:
Is there a way to check whether ports are down/up and/or whether services are running/stopped through CLI, API or other?
--- End quote ---

if you just want to know if it's working Plugged or unplugged,
I did it, simply using shell command with regex. It's maybe not the best way to do it, but for now it work. And that's the best I can do.

I just started Linux a few days ago and i'm not a computer scientist neither a native english speaker, you have probably noticed that.

For exemple :
 

--- Code: ---ifconfig igb2 | sed -n 's/.*status: \([^ ]*\).*/\1/gp'
--- End code ---

Will result as : "Active" or if not active "no"

For the services i tried something probably unprofessionnal, but i've seen that a file with extension .pid was created when a services is running.

So i just create an if condition to see if yes or no the file is there.


--- Code: ---if [ -e "/var/run/configd.pid" ];then
echo "configd active";
else
echo "configd not active"
fi
--- End code ---

it doesn't work for all services, i'm trying to find another solution.

if you guys have a better idea, it would be great. Because i'm pretty sure what i did is like DIY.

HOW CAN I DELETE THIS MESSAGE ?

jeje1307:

--- Quote ---And one last question:
Is there a way to check whether ports are down/up and/or whether services are running/stopped through CLI, API or other?
--- End quote ---

if you just want to know if it's working Plugged or unplugged,
I did it, simply using shell command with regex. It's maybe not the best way to do it, but for now it work. And that's the best I can do.

I just started Linux a few days ago and i'm not a computer scientist neither a native english speaker, you have probably noticed that.

For exemple :
 

--- Code: ---ifconfig igb2 | sed -n 's/.*status: \([^ ]*\).*/\1/gp'
--- End code ---

Will result as : "Active" or if not active "no"

For the services i've seen that a file with extension .pid was created when a services is running.

--- Code: ---#!/bin/sh
isvalidpid()
{
    /bin/pgrep -nF $1
}

is_process_running()
{
    /bin/pgrep -anx
}

if [ $(isvalidpid /var/run/ntpd.pid) > 1 ] && [ $(is_process_running) > 1 ]
then
    echo "Active"
else
    echo "Not"
fi
--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version