Configure Linux Service to send Metrics
For our last Onboard Things lesson, we are going to configure a Linux Service to automatically run the script so it doesn’t have to be run manually.

1 Return to your SSH session and press Ctrl-C to stop your script

2 Cat the virtualiotsensor.service file
cat virtualiotsensor.service
3 Note that the service descriptor file is expecting our script to reside in the /opt/virtualiotsensor folder

4 Create the virtualiotsensor folder and copy the
script to this location
mkdir /opt/virtualiotsensor
cp /opt/virtualiotsensor

5 Copy the virtualiotsensor.service file to /etc/systemd/system, change the permissions on the file and reload linux services
cp virtualiotsensor.service /etc/systemd/system
chmod 644 /etc/systemd/system/virtualiotsensor.service
sudo systemctl daemon-reload

6 Configure the newly created service to start at boot
sudo systemctl enable virtualiotsensor.service

7 Start your newly created Service
service virtualiotsensor start

8 Check your service status - note that it is active (running)
service virtualiotsensor status
(Press Q or CTRL-C to exit Service Status View)

Congratulations! The Service you just created is now automatically sending Environmental Metrics to Pulse.

BTW, if you are interested in seeing more of in action, issue the following command in your SSH session:

Pretty cool, eh?! :)

Here is the Github location (link)

<Thank you - this concludes our ‘Onboard Things' Lesson>