udpate
This commit is contained in:
@@ -27,8 +27,8 @@ fi
|
||||
info "Set up the RTC"
|
||||
/usr/bin/python3 /var/www/nebuleair_pro_4g/RTC/set_with_NTP.py
|
||||
|
||||
#Check SARA R4 connection
|
||||
info "Check SARA R4 connection"
|
||||
#Check SARA connection
|
||||
info "Check SARA connection"
|
||||
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 ATI 2
|
||||
|
||||
#set up SARA R4 APN
|
||||
@@ -44,45 +44,19 @@ info "Connect SARA R4 to network"
|
||||
python3 /var/www/nebuleair_pro_4g/SARA/sara_connectNetwork.py ttyAMA2 20810 60
|
||||
|
||||
#Need to create the two service
|
||||
# 1. master_nebuleair
|
||||
# 1. start the scripts to set-up the services
|
||||
# 2. rtc_save_to_db
|
||||
|
||||
#1. Add master_nebuleair.service
|
||||
SERVICE_FILE="/etc/systemd/system/master_nebuleair.service"
|
||||
info "Setting up systemd service for master_nebuleair..."
|
||||
|
||||
# Create the systemd service file (overwrite if necessary)
|
||||
sudo bash -c "cat > $SERVICE_FILE" <<EOF
|
||||
[Unit]
|
||||
Description=Master manager for the Python loop scripts
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/python3 /var/www/nebuleair_pro_4g/master.py
|
||||
Restart=always
|
||||
User=root
|
||||
WorkingDirectory=/var/www/nebuleair_pro_4g
|
||||
StandardOutput=append:/var/www/nebuleair_pro_4g/logs/master.log
|
||||
StandardError=append:/var/www/nebuleair_pro_4g/logs/master_errors.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
success "Systemd service file created: $SERVICE_FILE"
|
||||
|
||||
# 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 master_nebuleair.service
|
||||
|
||||
# Start the service immediately
|
||||
info "Starting the service..."
|
||||
sudo systemctl start master_nebuleair.service
|
||||
|
||||
#1. set-up the services (SARA, NPM, BME280, etc)
|
||||
info "Setting up systemd services..."
|
||||
|
||||
if [[ -f "$REPO_DIR/services/setup_services.sh" ]]; then
|
||||
sudo chmod +x "$REPO_DIR/services/setup_services.sh"
|
||||
sudo "$REPO_DIR/services/setup_services.sh" || warning "Failed to set up systemd services"
|
||||
success "Systemd services set up successfully."
|
||||
else
|
||||
warning "Systemd services setup script not found."
|
||||
fi
|
||||
|
||||
#2. Add rtc_save_to_db.service
|
||||
SERVICE_FILE_2="/etc/systemd/system/rtc_save_to_db.service"
|
||||
|
||||
Reference in New Issue
Block a user