【closed】configctl myshell test show execute error.

Started by moonmoonbird, October 29, 2020, 04:10:50 AM

Previous topic - Next topic
October 29, 2020, 04:10:50 AM Last Edit: October 29, 2020, 06:08:14 AM by moonmoonbird
/usr/local/opnsense/scripts/OPNsense/MyShell/executeshell.py:

   
import json                                                                     
result = {}                                                                     
result['message'] = 'this is moonmoonbird'                                     
print(json.dumps(result))


/usr/local/opnsense/service/conf/actions.d/actions_myshell.conf:

[test]                                                                         
command:/usr/local/opnsense/scripts/OPNsense/MyShell/executeshell.py           
parameters:                                                                     
type:script_output                                                             
message:myshell  module test



and then i restart configd and then  configctl myshell test, an error showed : Execute error.  No more message, anywhere i was doing wrong,



1、add header #!/usr/local/bin/python3 in py files.
2、chmod a+x  /usr/local/opnsense/scripts/OPNsense/MyShell/executeshell.py
3、 service configd restart
4、configctl myshell test