Go to the Home Page
Linux Command
1:cron
crontab -e
@reboot python3 /home/pi/my_program.py &
sudo reboot
ps aux
crontab -l
ps aux | grep python
sudo kill -9
sudo killall python3
2:systemd
sudo nano /etc/systemd/system/ex_led.service
[Unit]
Description=Run ex_led.py on startup
After=multi-user.target
[Service]
ExecStart=/usr/bin/python3 /home/pi/ex_led.py
WorkingDirectory=/home/pi
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start my_program.service
sudo systemctl stop my_program.service
sudo systemctl enable my_program.service
sudo systemctl disable my_program.service
sudo systemctl status my_program.service
sudo reboot
3:rc.local
sudo nano /etc/rc.local
sudo python3 /home/pi/my_program.py &
4:&
python3 /path/to/ex_pwm.py &
help jobs
jobs
fg
fg %1
5:nohup
nohup python3 /path/to/ex_pwm.py &
cat nohup.out
nohup python3 /path/to/ex_pwm.py > /path/to/output.log 2>&1 &
6:
which python3
@reboot sleep 10 && /usr/bin/python3 /path/to/ex_led.py
[Unit]
Description=Run ex_led.py on startup
After=multi-user.target
[Service]
ExecStart=/usr/bin/python3 /path/to/ex_led.py
WorkingDirectory=/home/pi
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi
[Install]
WantedBy=multi-user.target
7:
grep CRON /var/log/syslog
@reboot /usr/bin/python3 /path/to/ex_led.py > /home/pi/ex_led.log 2>&1
sudo chmod 644 /etc/systemd/system/ex_led.service
sudo chown root:root /etc/systemd/system/ex_led.service
8:
sudo lsof -i :8080
sudo kill -9 <pid>
sudo netstat -tuln | grep 8080
9:
ssh pi@172.16.54.134
sudo -i
whoami
su -
sudo systemctl restart ssh
exit
su pi
sudo -u pi -i
10: