ubuntu service start example 1

ubuntu service start example

systemctl start .service
systemctl status .service

Here is what the above code is Doing:
1. We’re creating a new service file called myservice.service in the /etc/systemd/system directory.
2. We’re telling systemd that this is a service that runs a program.
3. We’re telling systemd that the service is called myservice.
4. We’re telling systemd that the service should run the program /usr/bin/python3 and pass it the argument /home/pi/myscript.py.
5. We’re telling systemd that the service should run as the user pi.
6. We’re telling systemd that the service should run when the system boots.
7. We’re telling systemd to start the service.
8. We’re telling systemd to show us the status of the service.

Similar Posts