0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

linux > How to auto run python script > v0.3

Last updated at Posted at 2016-03-10

This article is for my hackaday.io project (BYOP).
https://hackaday.io/project/9526-bring-your-own-pizero-byop

About

How to auto run python script.

There are several ways to auto run python script.

Here's one way to do that.

setup /etc/rc.local

Raspberry Pi2 + raspbian

Setup by following http://qiita.com/7of9/items/ec9e38f84bc4351c5ee3

With root priviledge, add following lines to auto-run python script:

## for FileMessenger
cd /home/pi/python-160227-FileMessenger
nohup ./FileMessenger.py &

## for BYOP:Bring your own PiZero
cd /home/pi/python-160224-BYOP-main/
nohup ./BYOP-main.py &

exit 0

After the restart of the Raspberry Pi, you can check the scripts running by ps command.

BYOP-main.py will be automatically finished. So, ps command may not show the BYOP-main.py depending on the time.

pi@raspberrypi ~ $ ps aux | grep 15
...
root       560  0.1  0.6  10348  5936 ?        S    08:40   0:00 python ./FileMessenger.py
...
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?