Code Monkey home page Code Monkey logo

rpi4's Introduction

How to know if a piece of python code is working

ps aux | grep python

How to kill a running program

sudo pkill -f v5.py

Sample Output

vishal@raspberrypi:~ $ ps aux | grep python
root         571  0.0  0.1  12172  4480 ?        S    11:22   0:00 sudo python3 /home/vishal/v5.py
root         583  3.1  1.8 742828 73676 ?        Sl   11:23   0:08 python3 /home/vishal/v5.py
vishal       978  0.2  0.9  62492 36504 ?        S    11:23   0:00 /usr/bin/python3 /usr/share/system-config-printer/applet.py
vishal      1819  0.0  0.0   6044  1920 pts/1    S+   11:27   0:00 grep --color=auto python
vishal@raspberrypi:~ $ sudo pkill -f v5.py
vishal@raspberrypi:~ $ ps aux | grep python
vishal       978  0.1  0.9  62492 36504 ?        S    11:23   0:00 /usr/bin/python3 /usr/share/system-config-printer/applet.py
vishal      1863  0.0  0.0   6044  2048 pts/1    S+   11:28   0:00 grep --color=auto python
vishal@raspberrypi:~ $ 

Run a particular file upon reboot

crontab -e

Sample file output

# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
# 
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# 
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# 
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# 
# For more information see the manual pages of crontab(5) and cron(8)
# 
# m h  dom mon dow   command

@reboot sudo python3 /home/vishal/v5.py &

rpi4's People

Contributors

neurodisk23 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.