Configure Linux Service to send Metrics
For our last Onboard Things lesson, we are going to configure a Linux Service to automatically run the vIoT-Sensor.sh 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 vIoT-Sensor.sh script to reside in the /opt/virtualiotsensor folder

4 Create the virtualiotsensor folder and copy the vIoT-sensor.sh
script to this location
mkdir /opt/virtualiotsensor
cp vIoT-Sensor.sh /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 wttr.tn in action, issue the following command in your SSH session:
curl wttr.in/Paris


Pretty cool, eh?! :)

Here is the wttr.in Github location (link)

1/7/20 NOTE: The wttr.in service might be experiencing issues - apologies for any frustration, if so.

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