Robust, production-ready housekeeping scripts for Tableau Server with comprehensive error handling and TSM validation.
- Cross-platform: Windows (CMD) and Linux (Bash) versions
- Comprehensive error handling: TSM validation, detailed error messages, and specific exit codes
- Flexible configuration: Command line parameters and customizable variables
- Production-ready: Tested validation checks and robust error handling
- Easy automation: Ready for cron (Linux) or Task Scheduler (Windows)
tableau-server-backup-script.cmd- Creates backups and exports settingstableau-server-cleanup-script.cmd- Cleans up logs and temporary filestableau-server-log-archive-script.cmd- Archives current log files
Individual Function Scripts (Windows equivalent structure):
tableau-server-backup.bash- Creates backups and exports settingstableau-server-cleanup.bash- Cleans up logs and temporary filestableau-server-log-archive.bash- Archives current log files
Combined Scripts (Linux-specific):
tableau-server-housekeeping-linux.bash- Complete housekeeping (backup, logs, cleanup)tableau-server-logs-cleanup.bash- Archives logs and performs cleanup (legacy)
Script Organization: Linux now offers both individual scripts (matching Windows functionality) and combined scripts for convenience. Use individual scripts for targeted operations or combined scripts for comprehensive housekeeping.
- Tableau Server 2018.2 or later
- User Permissions: The user running the scripts must be a member of:
- Linux:
tsmadmingroup - Windows: Local Administrators group
- Linux:
- TSM availability: Scripts validate TSM is installed and responsive
- File Access: User needs read/write access to Tableau Server backup and log directories
- Download the appropriate scripts from the
windows/2019.2 and later/folder - Place scripts in a secure location accessible to your Tableau Server
- Run as a user who is a member of the Local Administrators group
Easy way: Use the setup script
wget https://raw.githubusercontent.com/til-jmac/tableau-server-housekeeping/master/linux/setup.bash
chmod +x setup.bash
./setup.bashManual way: Download scripts directly and customize as needed
Backup Script:
tableau-server-backup-script.cmd -n <filename> -d <days> -o <true/false>Cleanup Script:
tableau-server-cleanup-script.cmdLog Archive Script:
tableau-server-log-archive-script.cmd -d <days>Parameters:
-n, --name: Name of the backup file (no spaces, periods or special characters)-d, --days: Delete files older than N days-o, --overwrite: Overwrite existing files with same name (true/false)-h, --help: Show help
Backup Only:
/path/to/tableau-server-backup.bashCleanup Only:
/path/to/tableau-server-cleanup.bashLog Archive Only:
/path/to/tableau-server-log-archive.bash <retention_days>Complete Housekeeping:
/path/to/tableau-server-housekeeping-linux.bashLegacy Logs & Cleanup:
/path/to/tableau-server-logs-cleanup.bashWith credentials (pre-2019.2):
/path/to/script.bash <username> <password> [additional_params]Note: Run as a user who is a member of the tsmadmin group
All scripts include comprehensive error handling with specific exit codes for troubleshooting:
| Exit Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Not running with required administrator privileges |
| 2 | TSM command not found or not accessible |
| 3 | TSM not responsive or configuration issues |
| 4 | TSM configuration access denied |
| 5 | Failed to retrieve directory paths |
| 6 | Archive/Settings export operation failed |
| 7 | Backup/Cleanup operation failed |
Scripts automatically validate:
- TSM command availability
- TSM service responsiveness
- TSM configuration access
- Required directory paths
- Proper permissions
"TSM command not found"
- Ensure Tableau Server is installed
- Check TSM is in system PATH
- Verify running as correct user
"Cannot access TSM configuration"
- Check user is member of tsmadmin group (Linux) or Local Administrators (Windows)
- Verify TSM service is running
- Check Tableau Server status
"Permission denied"
- Ensure user is member of required group (tsmadmin/Local Administrators)
- Verify file permissions on script files
- Check directory permissions for backup/log paths
Always test scripts in a development environment first:
# Test mode - check what would happen
./script.bash --dry-run # (if supported)
# Check TSM access
tsm version
tsm status
# Verify permissions
id -nG # Linux - should show tsmadmin groupCreate scheduled tasks to run scripts automatically:
schtasks /create /tn "Tableau Backup" /tr "C:\path\to\tableau-server-backup-script.cmd -n daily-backup -d 7 -o false" /sc daily /st 02:00Add to crontab for automatic execution:
# Daily backup at 2 AM
0 2 * * * /var/opt/tableau/tableau_server/scripts/tableau-server-backup.bash >> /var/log/tableau-backup.log 2>&1
# Weekly cleanup on Sunday at 3 AM
0 3 * * 0 /var/opt/tableau/tableau_server/scripts/tableau-server-logs-cleanup.bash >> /var/log/tableau-cleanup.log 2>&1- Store scripts in secure locations with appropriate permissions
- Use dedicated service accounts with only required group membership (tsmadmin/Local Administrators)
- Regularly review and update retention policies
- Monitor script execution logs for security events
- Consider encrypting backup destinations
- Avoid running with unnecessary elevated privileges
| Tableau Server Version | Script Version | Notes |
|---|---|---|
| 2018.2 - 2019.1 | windows/2018.2 to 2019.1/ |
Requires username/password |
| 2019.2+ | windows/2019.2 and later/ |
No credentials required |
| All Linux versions | linux/ |
Auto-detects version |
These scripts are actively maintained and tested. Please:
- Test thoroughly in development environments
- Report issues via GitHub Issues
- Submit pull requests for improvements
For questions or feedback:
- Email: support@theinformationlab.co.uk
- GitHub Issues: Create an issue for bug reports or feature requests
MIT License - See LICENSE file for details.