Background Jobs and the & Operator
Background Jobs and the & Operator
Appending & to a command forks the process into the background, returning immediate control to the script:
# Start background worker
/opt/scripts/backup.sh /var/data &
BACKUP_PID=$!
echo "Backup running in background with PID: $BACKUP_PID"
# Built-in job management (interactive or set -m)
jobs -l