Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Autostart

To enable the Freenove Smart Car Server to run at startup follow the steps for your distro.

Credit of Leigh Dastey ([email protected]).

## SystemD Configuration

**INSTALL_DIR below should be replaced throughout to the path of the file on your system**

Edit **$INSTALL_DIR**/Service/smart-car-server and change $INSTALL_DIR to be the path of this file on your system

Then run the following commands:

sudo chmod 755 $INSTALL_DIR/Service/smart-car-server
sudo ln -s $INSTALL_DIR/Service/smart-car-server.service /lib/systemd/system/smart-car-server.service
sudo ln -s $INSTALL_DIR/Service/smart-car-server /etc/init.d/smart-car-server
sudo systemctl daemon-reload
sudo systemctl enable smart-car-server
sudo reboot

When the Pi restarts you will be able to connect client applications (i.e. mobile app) and test you can connect.

### SystemD Disable Autostart

To disable the SystemD autostart run

sudo systemctl disable smart-car-server

17 changes: 17 additions & 0 deletions Service/smart-car-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

#
# Copy this file to /etc/init.d/
#

### BEGIN INIT INFO
# Provides: smart-car-server
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Pi Smart Car Server
### END INIT INFO

sudo /usr/bin/python $INSTALL_DIR/Code/Server/main.py -t -n

12 changes: 12 additions & 0 deletions Service/smart-car-server.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Pi Smart Car Server
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStartPre=/bin/sleep 20
ExecStart=/bin/bash /etc/init.d/smart-car-server

[Install]
WantedBy=multi-user.target