cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Script Instances lost after reboot of ctrlX CORE

maurusbien
Established Member

Script Instances lost after reboot of ctrlX CORE

Hello everyone,

once I have created an script instances (like shown in this example here: https://developer.community.boschrexroth.com/t5/ctrlX-CORE/How-to-run-Python-scripts-on-the-ctrlX-CO...) it is not existing anymore when i reboot my ctrlX CORE (virtual). Should it be like this? Is there a possibility to save the created script instances permanetly?

Thanks!

2 REPLIES 2
Jochen_Mueller
Long-established Member

Re: Script Instances lost after reboot of ctrlX CORE

The current situation (RM20.11): After reboot the instances vanish. (like descripted)

If you see the necessarity to change this behauvior please contact me directly. So we can discuss it.

 

drschiffler
Member

Re: Script Instances lost after reboot of ctrlX CORE

Hi,

you can use the "init script" functionallity.

  1. Download and unzip the configuration via the web interface
  2. Write a python script 'init.py' with content eg. 'print("Hello ctrlX")' and save it in the configuration in the directory "script" (any other dir/filename would also work)
  3. Zip the configuration directory (now includes the init.py file) and upload it to the core via web ui
  4. Write on the datalyer node "script/cfg/init-script" the payload "{"file": "activeConfiguration/script/init.py","language": "python","parameter": []}" (can be done also via web ui)
  5. Reboot
  6. Now there is always a python instance called "Base" (prerequisite is the python runtime snap)
  7. POST the following payload on "script/instances/Base/cmd/file" to excecute any script you need (via web ui or REST API). Payload eg. '{"name":"activeConfiguration/script/myworker.py","param":[]}'

Notes:

Link to documentation

It seems in the docu linked above is a mistake according to the path for the init script see: activeConfiguration vs. activeSolution

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist