| Products | Versions |
|---|---|
| TIBCO Data Virtualization | All Supported Versions |
Use-Case: If there is a need to store the TDV logs in morethan one location at the same time, the following article might come in handy.
Note: TDV does not have any out of the box feature available to store TDV logs in multiple locations. This is due to the log_dir property pointing to a single static value and can't be used to add multiple locations.
1. Create two scripts copy_logs.sh and edit_cron.sh.
copy_logs.sh
#!/bin/bash
# Define source and destination directories
source_dir="/opt/tdv-8.7-10400/logs"
destination_dir="/opt/tdv-8.7-10400/secondLogs"
# Check if the destination directory exists, if not, create it
if [ ! -d "$destination_dir" ]; then
mkdir -p "$destination_dir"
fi
# Copy files forcefully from source to destination
cp -f "${source_dir}"/* "${destination_dir}/"
edit_cron.sh
#!/bin/bash
# Ask for the copy_logs.sh script path
read -p "Enter the absolute path of the script (copy_logs.sh): " script_path
# Create or update the cron job
(crontab -l 2>/dev/null; echo "*/5 * * * * ${script_path}") | crontab -
2. Make the script edit_cron.sh executable by running:
chmod +x edit_cron.sh copy_logs.sh
3. Execute edit_cron.sh which will set the cron job to execute copy_logs.sh in every 5 minutes:
/.edit_cron.sh
4. The above script will ask to enter the absolute path for the copy_edit.sh script. Example: If the copy_cron.sh script is inside "/home/user1/copy_cron.sh" then we will pass "/home/user1/copy_cron.sh" as the absolute path of copy_cron.sh script.
NOTE: The first script copy_logs.sh copies the logs folder and the TDV user will have to update the source and destination directory path in the script. The second script edit_cron.sh adds the first script to the cron list which will run the first script every 5 minutes.
(B). Hard Link
To create a hard link in Linux, execute the below command:
find /path/to/source_folder -type f -exec ln {} /path/to/target_folder \;