FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
10-04-2022 03:10 PM
Hello,
I have a snap that contains three applications that needs to be started in order with sometime in between. What is the best way to autostart these apps and give it the correct order. The autostart should happen when the PLC is started or restarted.
I tried autostart within passthrough, but this seems not to work, maybe I am missing some options that I can't find online either.
Thanks in advanced
Regards,
Osama
Solved! Go to Solution.
10-05-2022 03:39 PM
Hi Osama,
you could try to subsribe to this value in the Data Layer: "plc/app/Application/admin/state/runtime" and check if the plc is running.
I would suggest to make a fourth application (which runs no matter what) in your snap which watches this value and controls the startup of your other apps.
Best regards,
Nick
10-06-2022 11:05 AM
Hello,
Thanks for your reply, I should have mentioned that I am currently working on the virtual core and it seems that this node is not available on the virtual core. Regarding the fourth application, is it the only way to start the other three? Isn't there some commands that I can use in the YAML file to instruct the snap on how to start? Is there an example for autostart that I can check and build on?
Regards,
Osama
10-06-2022 01:08 PM
UPDATE: I was able to start the applications automatically, but this only works after the first installation of the snap, when I reboot the virtual core it shows that the commands are executed when monitoring using "top" command and services are listed as enabled and running, but the applications are actually not running.
Here is the part of my YAML
apps:
opcserver:
command: *****************
daemon: simple
passthrough:
restart-condition: always
restart-delay: 10s
plugs:
- network-bind
opcuadatalayer:
command: ***********
daemon: simple
passthrough:
start-timeout: 90s
restart-condition: always
restart-delay: 10s
plugs:
- network
- datalayer
- network-bind
opcuadatalayerclient:
command: ***************
daemon: simple
passthrough:
start-timeout: 90s
restart-condition: always
restart-delay: 10s
plugs:
- network
- datalayer
- network-bind
10-06-2022 01:10 PM
UPDATE: I was able to start the applications automatically, but this only works after the first installation of the snap, when I reboot the virtual core it shows that the commands are executed when monitoring using "top" command and services are listed as enabled and running, but the applications are actually not running.
Here is the part of my YAML
apps:
opcserver:
command: *****************
daemon: simple
passthrough:
restart-condition: always
restart-delay: 10s
plugs:
- network-bind
opcuadatalayer:
command: ***********
daemon: simple
passthrough:
start-timeout: 90s
restart-condition: always
restart-delay: 10s
plugs:
- network
- datalayer
- network-bind
opcuadatalayerclient:
command: ***************
daemon: simple
passthrough:
start-timeout: 90s
restart-condition: always
restart-delay: 10s
plugs:
- network
- datalayer
- network-bind
10-07-2022 12:49 PM
Hi Osama,
I'm sorry. I misunderstood your question. When you first said start of the PLC, I thought you are referring to the PLC-App.
When you define your application as daemon: simple it will get started after installation of the app and also on reboot of the ctrlX CORE. The restart conditions you defined will start the application, in case it gets stopped.
Some more information on that can be found in the snapcraft yaml reference.
Could you check via command line, if your snap is really not running?
Best regards,
Nick
10-10-2022 11:26 AM
Thank you for your help. I tried to install the snap on an actual CtrlX and it worked fine using the structure of YAML that is mentioned in the sample programs offered.