N things about homework
Check grades on Differentiation and Integration or the Four tasks and read the data sheets for I2C hardware study.
Periodic client
Most from what we did on Wednesday. Add calls to read the acceleramoter.
Systemd
References
- systemd Raspberry Pi
- Managing services with systemd from RedHat (recommended by David Reynolds)
- Running Services After the Network is up from freedesktop.org
- Really geeky details and history from Pid Eins
- python-systemd
Useful commands
- systemctl daemon-reload
- systemctl enable service
- systemctl start service
- systemctl status service
The problem with clients
If the network is unstable, servers just wait for connections. Clents initiate connections. Here is some code I use to make sure the network is available.
acc_connected = False while not acc_connected: try: acc_conn.connect((remote_host, remote_port)) acc_connected = True except socket.gaierror as msg: print("Unable to connect {0}".format(msg)) time.sleep(10)
The two setups
The [Unit]
and [Install]
sections
are the same and informed
by
systemd Raspberry Pi
and Running Services After the Network is up.
The [Service]
sections have an
ExecStart
statement simlar to that of
systemd Raspberry Pi tutorial.
One has definitions for
WorkingDirectory
User
which shouldn’t matter.
There is a definion for StandardOuput=syslog
which can be
useful for getting the status.
Then there are definitions for some pretty obscure options. Here is one set.
Type=oneshot
And here is other.
Type=simple Restart=no
You can read the
man page
systemd.service
and see if you can figure out what this is all about.
Another approach
Someone suggested the System V approach of modifying /etc/rc.local. However, this is the time for systemd.
One more thing
There were a fair number of systemd talks related to embedded systems at All Systems Go! 2017 meeting.