APEX ORIN MINI The Application Starts Automatically When the Computer Boots Up#
Explanation#
Most Miwen products require the program to run automatically when powered on.
Since sensors such as cameras have an initialization time, this document is used to illustrate how to correctly configure the automatic startup when powered on.
Modification instructions#
sudo vim /etc/systemd/sync_auto.sh
Make modifications at the following location
### Added modified code
# Wait for the camera to finish initializing
sleep 60
# Execute the customer's startup program
/usr/local/bin/customer_startup_script.sh &
##############
while :
do
sleep 1
done
customer_startup_script.sh Content example
sudo gedit /usr/local/bin/customer_startup_script.sh
#Add the following content
sudo chmod +x /usr/local/bin/customer_startup_script.sh
#!/bin/bash
# Customer startup script example
# Log file path
LOG_FILE="/var/log/customer_startup.log"
# Function: Write message to log file
log_message() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> "$LOG_FILE"
}
# Clear previous log
> "$LOG_FILE"
# Record the start of the script execution
log_message "Customer startup script starts execution"
# Simulate some initialization tasks
log_message "Initializing system configuration..."
sleep 2
log_message "System configuration initialization completed"
log_message "Starting customer application..."
sleep 3
log_message "Customer application started successfully"
# Simulate a continuously running process
while true; do
log_message "Customer application is running..."
sleep 300 # Log every 5 minutes
done
Verification method:#
Users can confirm whether their scripts are executed correctly by viewing the logs in the following paths.#
/var/log/customer_startup.log