OPNsense Forum

English Forums => Development and Code Review => Topic started by: moonmoonbird on October 29, 2020, 04:10:50 AM

Title: 【closed】configctl myshell test show execute error.
Post by: moonmoonbird on October 29, 2020, 04:10:50 AM
/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