How to run a python script after bootup automatically

I am using MangOH greeen board.
I want to run a python app automatically after each reboot and want to auto restart it in case of any failure.
**i tried to add it to /etc/init.d/ but it says **
read only file system
and i were not able to find any process manager where i can add my program to auto start it after each reboot.

how can this achievable?

please help to accomplish it.

You could write a legato app in C that invokes the python interpreter and passes your script to it. Then you could monitor whether the python interpreter exits. You could intentionally fault your own app in that case to leverage Legato’s built-in fault handling.

I think the plan is to support Python as a language for development of Legato apps and that work is underway, but it could be a number of months before Python support is included in a stable Legato release.

1 Like

@dfrey
I am very new to C language and legato development.
it would be very helpful if you suggest a sample app and some tweaks so i can do it simply.
i tried shell piping app from sample apps but it stopped due to some errors.

Jan 6 04:33:04 swi-mdm9x15 user.info Legato: INFO | supervisor[459]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link ‘/legato/systems/current/apps/ShellPiping/read-only/utilPipes’ to ‘/legato/systems/current/appsWriteable/ShellPiping/utilPipes’.
Jan 6 04:33:04 swi-mdm9x15 user.info Legato: INFO | supervisor[459]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link ‘/bin/sh’ to ‘/legato/systems/current/appsWriteable/ShellPiping/usr/local/bin/sh’.
Jan 6 04:33:04 swi-mdm9x15 user.info Legato: INFO | supervisor[459]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link ‘/bin/ls’ to ‘/legato/systems/current/appsWriteable/ShellPiping/usr/local/bin/ls’.
Jan 6 04:33:04 swi-mdm9x15 user.info Legato: INFO | supervisor[459]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link ‘/bin/grep’ to ‘/legato/systems/current/appsWriteable/ShellPiping/usr/local/bin/grep’.
Jan 6 04:33:04 swi-mdm9x15 user.info Legato: INFO | supervisor[459]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link ‘/bin/echo’ to ‘/legato/systems/current/appsWriteable/ShellPiping/usr/local/bin/echo’.
Jan 6 04:33:04 swi-mdm9x15 user.info Legato: INFO | supervisor[459]/supervisor T=main | app.c CreateTmpFs() 1204 | Mounted tmpfs at /legato/systems/current/appsWriteable/ShellPiping/tmp.
Jan 6 04:33:04 swi-mdm9x15 user.info Legato: INFO | supervisor[459]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link ‘/tmp/legato/serviceDirectoryServer’ to ‘/legato/systems/current/appsWriteable/ShellPiping/tmp/legato/serviceDirectoryServer’.
Jan 6 04:33:04 swi-mdm9x15 user.info Legato: INFO | supervisor[459]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link ‘/tmp/legato/serviceDirectoryClient’ to ‘/legato/systems/current/appsWriteable/ShellPiping/tmp/legato/serviceDirectoryClient’.
Jan 6 04:33:04 swi-mdm9x15 user.info Legato: INFO | supervisor[459]/supervisor T=main | apps.c DeactivateAppContainer() 340 | Application ‘ShellPiping’ has stopped.
Jan 6 04:33:11 swi-mdm9x15 user.info Legato: INFO | avcDaemon[513]/avcDaemon T=main | assetData.c assetData_CreateInstanceById() 2982 | Creating asset instance for ShellPiping/0
Jan 6 04:33:11 swi-mdm9x15 user.info Legato: INFO | avcDaemon[513]/avcDaemon T=main | assetData.c assetData_CreateInstanceById() 3079 | Finished creating instance 0 for ShellPiping/0
Jan 6 04:33:11 swi-mdm9x15 user.info Legato: INFO | avcDaemon[513]/avcDaemon T=main | assetData.c assetData_CreateInstanceById() 2982 | Creating asset instance for ShellPiping/1
Jan 6 04:33:11 swi-mdm9x15 user.info Legato: INFO | avcDaemon[513]/avcDaemon T=main | assetData.c assetData_CreateInstanceById() 3079 | Finished creating instance 0 for ShellPiping/1

Thanks in advance.