You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.8 KiB
Plaintext

Directions of service for continuos working
Command for the terminal to move the file to a more safe direction, where
"executable" is the name of the of the program executable in the folder
and "(/usr/ocal/bin/executable)" this are the new direction for the program
"sudo mv executable /usr/local/bin/executable"
After that we create the file of "systemd" with the next Command
"sudo nano /etc/systemd/system/sensor.service"
Now inside these file we put the next code:
[Unit]
Description=Servicio de lectura de sensores HTU21D y BH1750
After=network.target
[Service]
ExecStart=/usr/local/bin/sensor_logger -> changer sensor_logger to the name of the exutable file.
Restart=always
User=debian
WorkingDirectory=/home/debian
StandardOutput=file:/home/debian/sensor.log
StandardError=file:/home/debian/sensor_error.log
[Install]
WantedBy=multi-user.target
after that we allow the service with the next commands
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable sensor.service
sudo systemctl start sensor.service
At the end we check the status of the service with the next commands
sudo systemctl status sensor.service
To eliminate the service we need to enter the next commands
sudo systemctl stop sensor.service
sudo systemctl disable sensor.service
sudo rm /etc/systemd/system/sensor.service
sudo systemctl daemon-reload
in the case in which create files to see the logs enter the next commands
to eliminate the logs.
rm /home/debian/sensor.log
rm /home/debian/sensor_error.log
La dirección puede variaar dependiendo de la cual se haya puesto al principio
de desarrollo.