update
This commit is contained in:
@@ -39,7 +39,11 @@ info "Activate blue LED"
|
|||||||
info "Connect SARA R4 to network"
|
info "Connect SARA R4 to network"
|
||||||
python3 /var/www/nebuleair_pro_4g/SARA/sara_connectNetwork.py ttyAMA2 20810 60
|
python3 /var/www/nebuleair_pro_4g/SARA/sara_connectNetwork.py ttyAMA2 20810 60
|
||||||
|
|
||||||
#Add master_nebuleair.service
|
#Need to create the two service
|
||||||
|
# 1. master_nebuleair
|
||||||
|
# 2. rtc_save_to_db
|
||||||
|
|
||||||
|
#1. Add master_nebuleair.service
|
||||||
SERVICE_FILE="/etc/systemd/system/master_nebuleair.service"
|
SERVICE_FILE="/etc/systemd/system/master_nebuleair.service"
|
||||||
info "Setting up systemd service for master_nebuleair..."
|
info "Setting up systemd service for master_nebuleair..."
|
||||||
|
|
||||||
@@ -73,4 +77,42 @@ sudo systemctl enable master_nebuleair.service
|
|||||||
|
|
||||||
# Start the service immediately
|
# Start the service immediately
|
||||||
info "Starting the service..."
|
info "Starting the service..."
|
||||||
sudo systemctl start master_nebuleair.service
|
sudo systemctl start master_nebuleair.service
|
||||||
|
|
||||||
|
|
||||||
|
#2. Add master_nebuleair.service
|
||||||
|
SERVICE_FILE_2="/etc/systemd/system/rtc_save_to_db.service"
|
||||||
|
info "Setting up systemd service for rtc_save_to_db..."
|
||||||
|
|
||||||
|
# Create the systemd service file (overwrite if necessary)
|
||||||
|
sudo bash -c "cat > $SERVICE_FILE_2" <<EOF
|
||||||
|
[Unit]
|
||||||
|
Description=RTC Save to DB Script
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/python3 /var/www/nebuleair_pro_4g/RTC/save_to_db.py
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1
|
||||||
|
User=root
|
||||||
|
WorkingDirectory=/var/www/nebuleair_pro_4g
|
||||||
|
StandardOutput=append:/var/www/nebuleair_pro_4g/logs/rtc_save_to_db.log
|
||||||
|
StandardError=append:/var/www/nebuleair_pro_4g/logs/rtc_save_to_db_errors.log
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
success "Systemd service file created: $SERVICE_FILE_2"
|
||||||
|
|
||||||
|
# Reload systemd to recognize the new service
|
||||||
|
info "Reloading systemd daemon..."
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
|
||||||
|
# Enable the service to start on boot
|
||||||
|
info "Enabling the service to start on boot..."
|
||||||
|
sudo systemctl enable rtc_save_to_db.service
|
||||||
|
|
||||||
|
# Start the service immediately
|
||||||
|
info "Starting the service..."
|
||||||
|
sudo systemctl start rtc_save_to_db.service
|
||||||
|
|||||||
Reference in New Issue
Block a user