Jump to content


Photo

Network activation command for scheduled script

CLI

Best Answer Frank Dauer, 27 June 2016 - 11:07 AM

Hi,

 

as you said, this is neither recommended nor supported, but here you are:

 

#!/bin/bash

# force network activation

if [ ! -f /opt/phion/preserve/boxnet.conf ]; then
	echo "No pending network activation."
	exit
fi

echo "Activating new network configuration ..."
/opt/phion/modules/box/boxnet/bin/activate /opt/phion/preserve/boxnet.conf

if [ $? -ne 0 ]; then
	echo "Activation failed, reverting to previous configuration ..."
	/opt/phion/modules/box/boxnet/bin/activate
else
	echo "Activation succeeded."
	cp /opt/phion/preserve/boxnet.conf /opt/phion/config/active/boxnet.conf.tmp
	mv /opt/phion/config/active/boxnet.conf.tmp /opt/phion/config/active/boxnet.conf
	rm /opt/phion/preserve/boxnet.conf

	/opt/phion/bin/boxkey
	/opt/phion/bin/acpfrule i
fi

Frank

Go to the full post


  • Please log in to reply
1 reply to this topic

#1 Aldo dos Santos

Aldo dos Santos
  • Members
  • 14 posts
  • LocationHanover

Posted 27 June 2016 - 09:09 AM

Hello,

 

can you please tell me the command to make network activation (failsafe/force) from CLI.

I'd like to use it from my CC via Remote execution as scheduled script in case that I want to enable new networks outside of workhours.

I've already tried on my test enviroment

/etc/phion/bin/boxnet -f

but this killed my box :(

 

Kind regards,

Aldo dos Santos

 

P.s. I know that this is not recommend, but provide me this information nevertheless please ;)



#2 Frank Dauer

Frank Dauer
  • Barracuda Team Members
  • 24 posts
  • LocationInnsbruck

Posted 27 June 2016 - 11:07 AM   Best Answer

Hi,

 

as you said, this is neither recommended nor supported, but here you are:

 

#!/bin/bash

# force network activation

if [ ! -f /opt/phion/preserve/boxnet.conf ]; then
	echo "No pending network activation."
	exit
fi

echo "Activating new network configuration ..."
/opt/phion/modules/box/boxnet/bin/activate /opt/phion/preserve/boxnet.conf

if [ $? -ne 0 ]; then
	echo "Activation failed, reverting to previous configuration ..."
	/opt/phion/modules/box/boxnet/bin/activate
else
	echo "Activation succeeded."
	cp /opt/phion/preserve/boxnet.conf /opt/phion/config/active/boxnet.conf.tmp
	mv /opt/phion/config/active/boxnet.conf.tmp /opt/phion/config/active/boxnet.conf
	rm /opt/phion/preserve/boxnet.conf

	/opt/phion/bin/boxkey
	/opt/phion/bin/acpfrule i
fi

Frank