Both sides previous revisionPrevious revisionNext revision | Previous revision |
technote:add_remove_flags_by_last_read [2021/07/20 01:08] – [Sample Files] Scott Cunliffe | technote:add_remove_flags_by_last_read [2025/01/21 22:07] (current) – external edit 127.0.0.1 |
---|
====== Add Remove Flags Based Off Last Read Time ====== | ====== Add Or Remove Flags Based Off Last Read Time ====== |
| |
Add or Remove Flags based off last read time of Volumes using TMSS10ModifyFlags and a config file. | Add or Remove [[common:volume_flags|Flags]] based off last read time of [[object:volume|Volumes]] using [[cli:tmss10modifyflags|TMSS10ModifyFlags]] and a config file. |
| |
The process involves TMSS10ModifyFlags loading an input file, using a definition file, to extract the Volume-ID's. The Volume-ID's are then filtered using the configuration file and adding any qualifying Volumes to a scan file. | One purpose of this method allows you to lock any [[object:volume|Volumes]] in your Library that have been recalled for data restoration and then automatically remove the move lock once the last read time passes a set number of days. The Sync can then place the [[object:volume|Volumes]] in a move back to the Offsite Vault until the data expires. |
| |
The scan file is then processed, adding or removing the defined Flags against the scan list Volumes. | The process involves [[cli:tmss10modifyflags|TMSS10ModifyFlags]] loading an input file, using a definition file, to extract the [[object:volume|Volume-ID's]]. The [[object:volume|Volume-ID's]] are then filtered using the configuration file and adding any qualifying [[object:volume|Volumes]] to a scan file. |
| |
| The scan file is then processed, adding or removing the defined [[common:volume_flags|Flags]] against the scan list [[object:volume|Volumes]]. |
| |
===== Sample Files ===== | ===== Sample Files ===== |
| |
Input file - Volumes.csv | ==== Input file - Volumes.csv ==== |
| |
| <code> |
| 100001L5,OFFS,2021/07/15 22:10:33 |
| 100002L5,OFFS,2021/07/25 22:10:34 |
| 100003L5,OFFS,2021/07/25 22:10:35 |
| 100004L5,OFFS,2021/07/25 22:10:36 |
| 100005L5,OFFS,2021/07/28 22:10:37 |
| 100006L5,OFFS,2021/06/15 22:10:38 |
| 100007L5,OFFS,2021/06/16 22:10:39 |
| 100008L5,OFFS,2021/06/17 22:10:40 |
| 100009L5,OFFS,2021/06/18 22:10:41 |
| 100010L5,OFFS,2021/06/19 22:10:42 |
| </code> |
| |
| === Definition file - default.ttidef === |
| |
001,OFFS,2021/07/15 22:10:33 | |
002,OFFS,2021/07/15 22:10:34 | |
003,OFFS,2021/07/15 22:10:35 | |
004,OFFS,2021/07/15 22:10:36 | |
005,OFFS,2021/07/15 22:10:37 | |
006,OFFS,2021/06/15 22:10:38 | |
007,OFFS,2021/06/16 22:10:39 | |
008,OFFS,2021/06/17 22:10:40 | |
009,OFFS,2021/06/18 22:10:41 | |
010,OFFS,2021/06/19 22:10:42 | |
| |
Definition file - default.ttidef | The definition file provides the information on how to extract the [[object:volume|Volume-ID]] from the input file into the barcode field, as well as setting the [[object:customer|Customer-ID]] and [[object:media|Media-ID]]. |
| |
# Set input file (use full path if not in current directory) | # Set input file (use full path if not in current directory) |
| |
# Extract Volume-ID into BARCODE field | # Extract Volume-ID into BARCODE field |
extract(BARCODE, 1, 3, 0); | extract(BARCODE, 1, 8, 0); |
| |
| |
Configuration file - last_read.cfg | == Configuration file - last_read.cfg == |
| |
| |
| Configuration file sets definition file for translating and extracting [[object:volume|Volume-ID's]] and filters input by [[object:customer|Customer-ID]] (0002), [[object:media|Media-ID]] (LTO). The last read time is then compared to the lastreadtime filter, if the last read time is 30 or more days ago, the [[object:volume|Volume]] is added to the scan file, if not it is discarded. |
| |
traversal = | traversal = |
); | ); |
}; | }; |
| |
| |
| == Batch file - run_remove_lock_flag.bat == |
| |
| |
| Run [[cli:tmss10modifyflags|TMSS10ModifyFlags]] to remove lock flag from all [[object:volume|Volumes]] in the input file with a last read date of 30 or more days ago. Using the Volume filter (-V) to only read in [[object:customer|Customer-ID]] 0002 to save processing time by avoiding reading in all other [[object:customer|Customer-ID's]]. Output from the process being written to modify_flags_stdout.txt and modify_flags_stderr.txt. The output files can written to any directory by using full directory paths. |
| |
| TMSS10ModifyFlags -S user:-password@server -F "!l" -c last_read.cfg -V 0002.LTO.* > modify_flags_stdout.txt 2> modify_flags_stderr.txt |
| |
| ==== Example Output ==== |
| |
| modify_flags_std.txt |
| |
| <code> |
| |
| System: TapeTrack |
| Report Description: Scan-File Load Report |
| Production Time: Friday, July 30, 2021 - 10:36:51 (AUS Eastern Standard Time) |
| Report Width: 149 bytes |
| |
| Seq. Record Barcode Resolved As Status Notes |
| ------ ------ ---------------------------------------- -------------------- ------ ---------------------------------------------------------------- |
| 1 1 100001L5 US02.LTO.100001L5 OK |
| 2 2 100002L5 US02.LTO.100002L5 OK |
| 3 3 100003L5 US02.LTO.100003L5 OK |
| 4 4 100004L5 US02.LTO.100004L5 OK |
| 5 5 100005L5 US02.LTO.100005L5 OK |
| 6 6 100006L5 US02.LTO.100006L5 OK |
| 7 7 100007L5 US02.LTO.100007L5 OK |
| 8 8 100008L5 US02.LTO.100008L5 OK |
| 9 9 100009L5 US02.LTO.100009L5 OK |
| 10 10 100010L5 US02.LTO.100010L5 OK |
| ------ ------ ---------------------------------------- -------------------- ------ ---------------------------------------------------------------- |
| |
| System: TapeTrack |
| Report Description: Flag Modification Report |
| Production Time: Friday, July 30, 2021 - 10:36:51 (AUS Eastern Standard Time) |
| Report Width: 156 bytes |
| |
| Seq. Barcode Old Flags New Flags Message |
| ------ -------------------- -------------------------------- -------------------------------- ------------------------------------------------------------ |
| 1 US02.LTO.100006L5 ClMn CMn Request OK |
| 2 US02.LTO.100007L5 ClMn CMn Request OK |
| 3 US02.LTO.100008L5 ClMn CMn Request OK |
| 4 US02.LTO.100009L5 ClMn CMn Request OK |
| 5 US02.LTO.100010L5 ClMn CMn Request OK |
| ------ -------------------- -------------------------------- -------------------------------- ------------------------------------------------------------ |
| |
| </code> |
| |
| |
| |
| {{tag> technote config cli report}} |
| |