# How to run a python script after bootup automatically

**URL:** https://mangoh.discourse.group/t/how-to-run-a-python-script-after-bootup-automatically/570
**Category:** mangOH Green
**Created:** [June 12, 2017, 8:25am UTC](https://mangoh.discourse.group/t/how-to-run-a-python-script-after-bootup-automatically/570 "2017-06-12T08:25:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![umesh-gp](https://avatars.discourse-cdn.com/v4/letter/u/90db22/32.png) [@umesh-gp](https://mangoh.discourse.group/u/umesh-gp)
#### Post date: [June 12, 2017, 8:25am UTC](https://mangoh.discourse.group/t/how-to-run-a-python-script-after-bootup-automatically/570/1 "2017-06-12T08:25:42Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dfrey](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/dfrey/32/303_2.png) [@dfrey](https://mangoh.discourse.group/u/dfrey)
#### Post date: [June 12, 2017, 9:56am UTC](https://mangoh.discourse.group/t/how-to-run-a-python-script-after-bootup-automatically/570/2 "2017-06-12T09:56:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![umesh-gp](https://avatars.discourse-cdn.com/v4/letter/u/90db22/32.png) [@umesh-gp](https://mangoh.discourse.group/u/umesh-gp)
#### Post date: [June 12, 2017, 10:25am UTC](https://mangoh.discourse.group/t/how-to-run-a-python-script-after-bootup-automatically/570/3 "2017-06-12T10:25:27Z")

</div>

@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](http://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](http://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](http://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](http://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](http://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](http://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](http://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](http://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](http://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](http://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](http://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](http://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](http://user.info) Legato: INFO | avcDaemon[513]/avcDaemon T=main | assetData.c assetData\_CreateInstanceById() 3079 | Finished creating instance 0 for ShellPiping/1

Thanks in advance.
