Fwconsole and Post-Restore Hook


Is it possible to use fwconsole in a Post-Restore Hook bash file?

I have two servers. I want to backup/restore the configuration between the two servers. I want to activate only one sip trunk on the second server. For that it is possible to use the command fwconsole trunk and just after fwconsole reload in the Post-Restore Hook bash file?

Why not exclude the Trunk/Network/NAT Settings? That way you don’t have to deal with this.

But if you want to use the hooking route, try to add in the post restore hook the following:

/usr/sbin/fwconsole trunks --disable <Trunk ID>

Thanks for your answer.

It is exactly my question : is it possible to do that followed by fwconsole reload in post restore hook ?

It should be. If it doesn’t work, please post the logs using pastebin.

But I still suggest to follow the first suggestion.

I try to do that. I have a problem : file not found. The bash file is in /home/asterisk proprietary asterisk, permission 0777. Is it the right place for that?

Don’t use a bash file, just put the command I posted above in the post restore hook field.

Great. It works !

It is not necessary to write /usr/sbin/ before fwconsole

It is possible to have several commands like fwconsole trunks --disable 1 | fwconsole trunks --disable 4 | …

fwconsole reload works but does not seem necessary.

Thanks for your help!

Try && between commands

It works with && rather than |

Is there a difference between these two possibilities?

| doesn’t make sense in this context; it says feed the output from the first command as input to the second.

&& means only run the second if the first succeeded. I suspect it was suggested because ; which means run the second unconditionally, needs to be escaped, because it is otherwise interpreted as starting a comment in the dialplan.

Thanks for your answer.