Avamar: Avtar Fails When Run-at-Start Script Returns Non‑Zero Exit Code
Summary: Backups fail when a user‑defined run‑at‑start script is used because the script returns exit code 1; avtar treats any non‑zero code as an error (such as, "avtar Info: Back from run‑at‑start, exit code 1"). Correct the script to exit 0 to resolve. ...
Symptoms
Backup failures when using a run‑at‑start script
Backups do not complete when a custom run‑at‑start script is configured for avtar.
- Avtar logs indicate it returned from the run‑at‑start script with a non‑zero exit code.
- Backup jobs are marked as failed.
- Disabling the run‑at‑start script allows the backup to succeed.
avtar Info : Back from run-at-start, exit code 1 avtar Error : Exiting avtar with run-at-start script failure 1
Cause
Improper Exit Code from Run‑at‑Start Script
The backup fails because the custom run‑at‑start script returns an exit code other than 0 . In Linux/UNIX environments, 0 is the only value that indicates success. Avtar interprets any non‑zero value as a script failure, causing the backup process to abort.
- The script returned exit code
1, whichavtarlogged as an error. - Avamar treats this non‑zero exit code as a failure and stops the backup operation.
Relevant log entry:
avtar Info : Back from run-at-start, exit code 1 avtar Error : Exiting avtar with run-at-start script failure 1
Resolution
Correcting avtar run‑at‑start script failures
Step‑by‑step resolution
When a customized run‑at‑start script returns a non‑zero exit code, avtar treats the backup as failed. Follow these steps to ensure the script returns 0 on success.
- Locate the script configured for the avtar run‑at‑start phase (such as,
/opt/avamar/etc/run_at_start.d/custom_script.sh). - Open the script in an editor and verify the logic that determines success or failure.
- At the end of the script, add or modify the exit statement so that a successful execution ends with
exit 0. - Ensure any error paths also use appropriate non‑zero codes only when a genuine failure occurs.
- Save the changes and set executable permissions if they are not already set.
Example of a proper script termination:
#!/bin/bash
# Your custom logic here
if [ $? -eq 0 ]; then
echo "Custom script completed successfully"
exit 0
else
echo "Custom script encountered an error"
exit 1
fi
Validate the script locally
Run the script manually and confirm it exits with 0 .
$ /opt/avamar/etc/run_at_start.d/custom_script.sh Custom script completed successfully $ echo $? 0
Restart avtar and trigger a backup.
After confirming the script returns 0, restart the avtar service and start a backup job to verify normal operation.
# Restart avtar service $ systemctl restart avtar # Initiate a test backup (replace and as needed) $ avtar -c -p -b
Confirm the resolution.
Check the avtar log for the absence of the error message "Exiting avtar with run‑at‑start script failure 1." A successful log entry resembles the following:
[2025-10-09 12:34:56] INFO avtar Info : Back from run-at-start, exit code 0 [2025-10-09 12:35:10] INFO Backup completed successfully