- Create your script,"script.sh" e.g.
#!/bin/bash
cd /home/wilson/opencv-starter-pack/python/basic
python open_video.py
-
Create your own service, .e.g Create a new file using your preferred text editor, vim, nano, gedit, use sudo if required
sudo gedit /etc/systemd/system/faceapp.service
-
Paste this in your file and change accordingly
[Unit]
Description=This service runs Face Recognition App upon bootup
[Service]
Type=oneshot
ExecStart=/bin/bash "/home/wilson/script.sh" start
ExecStop=/bin/bash "/home/wilson/script.sh" stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
-
Change permission
sudo chmod u+rwx /etc/systemd/system/faceapp.service
-
Enable the service
sudo systemctl enable faceapp