technote:netcat:linux_sync
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
technote:netcat:linux_sync [2021/06/15 03:27] – Scott Cunliffe | technote:netcat:linux_sync [2025/01/21 22:07] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 14: | Line 14: | ||
Create a script (eg run-remote-sync.sh) on your sending server, with executable permissions. | Create a script (eg run-remote-sync.sh) on your sending server, with executable permissions. | ||
+ | Add the required code to extract the Volume data to be Sync'd with your TapeTrack (receiving) Server into a text or CSV file. | ||
+ | vmquery -W -a > report.txt | ||
+ | Add the call Netcat, including the IP address and Port of the receiving server, along with the input data file. In the example the IP is XXX.XXX.XXX.XXX and Port 4545, these need to be replaced with your actual IP and Port numbers. | ||
+ | |||
+ | You can also record the output from the Sync if required by redirecting the stdin stream to file (eg Sync-output.txt). | ||
+ | |||
+ | nc XXX.XXX.XXX.XXX 4545 < ./ | ||
+ | |||
+ | By placing both the vmquery code with the netcat execution code in the same script, you can schedule the script to run using cron or similar to execute the data extraction and call to the Sync process on the receiving server. | ||
+ | ===== Setting Up Receiving Server ===== | ||
| | ||
+ | Create an entry in the / | ||
+ | |||
+ | receive-sync | ||
+ | | ||
+ | Create the xinetd service file (receive-sync) in / | ||
+ | |||
+ | | ||
+ | { | ||
+ | disable | ||
+ | socket_type | ||
+ | protocol | ||
+ | port = 4545 | ||
+ | wait = no | ||
+ | user = root | ||
+ | server | ||
+ | server_args | ||
+ | only_from | ||
+ | log_on_failure | ||
+ | } | ||
+ | |||
+ | For other options see the Linux xinetd manual pages. | ||
+ | |||
+ | Restart the xinetd service to refresh the data. | ||
+ | |||
+ | | ||
+ | |||
+ | |||
+ | ===== Create Script To Execute When Port 4545 Request Is Received ===== | ||
+ | |||
+ | Create a script at ''/ | ||
+ | |||
+ | Add the code to execute the Sync, including the full path to the ttidef file | ||
+ | |||
+ | #!/bin/bash | ||
+ | cd / | ||
+ | | ||
+ | / | ||
+ | | ||
+ | exit | ||
+ | |||
+ | When the Sync program is executed by the sending server with a call to the port, the data file will be passed to the Sync program via the stdin stream. | ||
+ | |||
+ | Ensure the ttidef file is either in the same directory, or at the location stated in the script so the Sync program has access. | ||
+ | Examples of ttidef files: | ||
+ | * [[cookbook: | ||
+ | * [[cookbook: | ||
+ | * [[cookbook: | ||
+ | * [[cookbook: | ||
+ | * [[cookbook: | ||
+ | * [[cookbook: | ||
+ | * [[cookbook: | ||
+ | Output from the Sync process will be passed back to the sending server from the stderr stream to the stdin stream. | ||
+ | This can be altered to write the output to file on either computer by using the > and 2> redirection streams to text file if required. | ||
+ | {{tag> technote netcat linux sync xinetd}} | ||
| | ||
technote/netcat/linux_sync.1623727655.txt.gz · Last modified: 2025/01/21 22:07 (external edit)