I want to call AOS commands at an intervall. That's why I've created a python script and added it to a cronjob. The script is called by cronjob as expected (checked by updated content of cron.log). But the execution of AOS command (os.popen(cmd).read()) is not working, an exception is not thrown. However, if I call the python script manually from CLI the AOS command is executed as expected.
The python script /flash/python/cron.py:
#!/usr/bin/env python3 import os,datetime def exec_cmd(cmd): try: cmd_res=os.popen(cmd).read() return cmd_res.strip() except: return '' # testlog when the script was executed f=open('/flash/cron.log','w') f.write(datetime.datetime.now().strftime('%d.%B %Y %H:%M:%S')+'\n') f.close() # main exec_cmd('interfaces 8/1/9 admin-state disable')BTW, the file permissions of the script are set to 755.
Regards Holger