Auto start a Python service on beaglebone angustrom
after making several python web service, I wish to have the web service starts when power on beaglebone, this link is the reference:
http://stackoverflow.com/questions/11152657/angstrom-start-up-processes-beaglebone
example:
Go in to /lib/systemd/system/ and open the bone101.service, this is a service file for 101 stuff.
so we have to create our service
I have a PyBBIO web service stuff named as u4glass_tank.py
saved as glass_tank.service
Then go to terminal do the following:
systemctl enable glass_tank.service
To start the service, you can reboot or execute
systemctl start glass_tank.service
To check if the service is running and get the latest outputs from the script:
root@beaglebone:~# systemctl status glass_tank.service
in terminal it would return like this:
glass_tank.service - glasstank web service
Loaded: loaded (/lib/systemd/system/glass_tank.service; enabled)
Active: active (running) since Thu, 22 Nov 2012 12:28:44 +0000; 5 months and 17 days ago
Main PID: 332 (python)
CGroup: name=systemd:/system/glass_tank.service
â 332 /usr/bin/python u4glass_tank.py
â 334 /usr/bin/python u4glass_tank.py
if we wish to remove this service from startup list,use following command:
systemctl disable glass_tank.service
terminal would return rm '/etc/systemd/system/multi-user.target.wants/glass_tank.service'
if you check with systemctl status glass_tank.service, ou will find the service is still running.
to stop the service right away, you will need:
systemctl stop glass_tank.service
then, check again with systemctl status glass_tank.service, you will see it's stopped.
When working with new beaglebone black with debian, I met some problem, that the service is loaded, but not active, it's always shown dead
another example on debian
https://gist.github.com/tstellanova/7323116
http://stackoverflow.com/questions/11152657/angstrom-start-up-processes-beaglebone
example:
Go in to /lib/systemd/system/ and open the bone101.service, this is a service file for 101 stuff.
so we have to create our service
I have a PyBBIO web service stuff named as u4glass_tank.py
saved as glass_tank.service
[Unit]
Description=Python glass tank web service
[Service]
WorkingDirectory=/home/root/PyBBIO/examples
ExecStart=/usr/bin/python u4glass_tank.py
[Install]
WantedBy=multi-user.target
Then go to terminal do the following:
systemctl enable glass_tank.service
To start the service, you can reboot or execute
systemctl start glass_tank.service
To check if the service is running and get the latest outputs from the script:
root@beaglebone:~# systemctl status glass_tank.service
in terminal it would return like this:
glass_tank.service - glasstank web service
Loaded: loaded (/lib/systemd/system/glass_tank.service; enabled)
Active: active (running) since Thu, 22 Nov 2012 12:28:44 +0000; 5 months and 17 days ago
Main PID: 332 (python)
CGroup: name=systemd:/system/glass_tank.service
â 332 /usr/bin/python u4glass_tank.py
â 334 /usr/bin/python u4glass_tank.py
if we wish to remove this service from startup list,use following command:
systemctl disable glass_tank.service
terminal would return rm '/etc/systemd/system/multi-user.target.wants/glass_tank.service'
if you check with systemctl status glass_tank.service, ou will find the service is still running.
to stop the service right away, you will need:
systemctl stop glass_tank.service
then, check again with systemctl status glass_tank.service, you will see it's stopped.
When working with new beaglebone black with debian, I met some problem, that the service is loaded, but not active, it's always shown dead
another example on debian
https://gist.github.com/tstellanova/7323116
留言
張貼留言