Sponsored Content
Top Forums Shell Programming and Scripting Help understanding the script Post 302983599 by Chubler_XL on Thursday 13th of October 2016 04:20:17 PM
Old 10-13-2016
The backup backup Julian date calculation is quite simple if you have GNU date available on your system.

GNU date would allow us to convert date strings in this manor:

Code:
$ date -d "Oct 7 2016"
Fri, Oct 07, 2016 12:00:00 AM

Your calculation would then simply be:

Code:
PrevHostname=''
PrevBackup=0
while read input
do
  if [[ ${input:9:1} = ':' ]] then
     DateStr="${input:0:3} ${input:4:2}"
  else
     DateStr="${input:0:3} ${input:4:2} 20${input:10:2}"
  fi
  Backup=$(( $(date -d "$DateStr" +%y*365+%j) ))

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need help understanding script command

We use a UNIX-based system (Lawson) at work and I was given this command to request a data extract from the db admin. The only thing I really understand is the last line as it appears to be joining the files created from the first three lines into one. Is there anyone who can help me breakdown the... (4 Replies)
Discussion started by: KGee
4 Replies

2. Shell Programming and Scripting

Help understanding a script

Hello everybody, Can anybody tell me of what "~" refers to in the below code snippet. lsvg $vgNAME | awk 'BEGIN {freeDISK=1} {if (($4 ~ /PP/ && $5 ~ /SIZE/) || ($4 ~ /FREE/ && $5 ~ /PPs/)) {freeDISK *= $6 }} END {print freeDISK*1024 }' Thanks in advance, (6 Replies)
Discussion started by: tenderfoot
6 Replies

3. Shell Programming and Scripting

Need help for understanding of script

# sub: find block (in cols), return line-numbers (begin-end) or 0 if notfound sub findb{ my ($exp1,$col1,$exp2,$col2)= @_; # $exp = expression to find, $col - column to search in my $cnt=0; my ($val1,$val2); my ($beg,$end); for($cnt=1;$cnt<=65536;$cnt++){ $val1 =... (3 Replies)
Discussion started by: suvenduperl
3 Replies

4. UNIX for Advanced & Expert Users

understanding awk in this script

i am analyzing a query written by another developer ,need to understand part of script am looking at a code ..and it converts comma files to pipe delimited and also takes away quotes from any columns, source field format: 2510,"Debbie",NewYork changes to target: 2510|Debbie|NewYork ... (1 Reply)
Discussion started by: coolrock
1 Replies

5. Shell Programming and Scripting

Need help understanding this script.

Can someone explain what is happening line by line in this script, particularly after the do statement. The script works, it renames all the files in my directory that has a date in the file name. But I would like to know more about it. #!/bin/bash newdate=12-10-1995 for file in *--* do ... (6 Replies)
Discussion started by: Harleyrci
6 Replies

6. UNIX for Dummies Questions & Answers

help with understanding script

i am trying to understand this script example. the text does not explain it. can someone tell me briefly what each of the functions do. any help will be appreciated. #!/bin/bash killtree() { local _pid=$1 local _sig=${2-TERM} for _child in $(ps -o pid --no-headers --ppid... (1 Reply)
Discussion started by: iluvsushi
1 Replies

7. Shell Programming and Scripting

Help understanding the script

Hi Guys, I am new to scripting , I am trying to rebuild a script based on an old script. Can someone help me figure out what the script is doing? This is only a part of the script. I am looking to interpret these two points in the scripts:- 1) test=`echo $?` while I do not... (3 Replies)
Discussion started by: rajsan
3 Replies

8. Shell Programming and Scripting

Help--understanding the script

Hi, New to this forum, as well as to unix scripting..need help to understand below script ... sendNotice_sp() { ATTACH=${LNXLOG:-} if ; then if ; then mail -s "$ERR_MSG" $ERR_EMAIL_TO < $ATTACH fi else mail -s "$ERR_MSG" $ERR_EMAIL_TO < /dev/null fi } afaik this is sm kind of... (6 Replies)
Discussion started by: gnnsprapa
6 Replies

9. UNIX for Beginners Questions & Answers

Shall script use and understanding

Below script is called as Reducer, I am not sure how it work, can some expert explain me what this script does as i am a beginner. inputfile: hi hi how are are you code: #!/bin/bash lastkey=""; -- what does this mean, because i saw in debug mode it is taking value as hi count=0;... (13 Replies)
Discussion started by: mirwasim
13 Replies

10. UNIX for Beginners Questions & Answers

Understanding a script for sum

Hello, How come the following script adds each numeric value to a total sum ? x=$1 func() { for i in $1 $2 $3; do let x= $x+$i done } func "8 8 8" 9 9 echo $x A.How the program sums the string "8 8 8" if it`s only the first field value ($1)? B.If we define x to be $1... (3 Replies)
Discussion started by: uniran
3 Replies
BACKUP_VOLINFO(8)					       AFS Command Reference						 BACKUP_VOLINFO(8)

NAME
       backup_volinfo - Displays a volume's dump history from the Backup Database

SYNOPSIS
       backup volinfo -volume <volume name> [-localauth]
	   [-cell <cell name>] [-help]

       backup voli -v <volume name>
	   [-l] [-c <cell name>] [-h]

DESCRIPTION
       The backup volinfo command displays a dump history of the specified volume, reporting information such as the date on which the volume was
       dumped and the tapes that contain it. Include the ".backup" extension on the volume name if the backup version of the volume was dumped.

OPTIONS
       -volume <volume name>
	   Names the volume for which to display the dump history. Include the ".backup" or ".readonly" extension if the backup or read-only
	   version of the volume was dumped.

       -localauth
	   Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The backup command interpreter presents it to
	   the Backup Server, Volume Server and VL Server during mutual authentication. Do not combine this flag with the -cell argument. For more
	   details, see backup(8).

       -cell <cell name>
	   Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see backup(8).

       -help
	   Prints the online help for this command. All other valid options are ignored.

OUTPUT
       The output includes a line for each Backup Database dump record that mentions the specified volume, order from most to least recent. The
       output for each record appears in a table with six columns:

       dumpID
	   The dump ID of the dump that includes the volume.

       lvl The depth in the dump hierarchy of the dump level at which the volume was dumped. A value of 0 indicates a full dump. A value of 1 or
	   greater indicates an incremental dump made at the specified depth in the dump hierarchy.

       parentid
	   The dump ID of the dump's parent dump. A value of 0 indicates a full dump, which has no parent; in this case, the value in the "lvl"
	   column is also 0.

       creation date
	   The date and time at which the Backup System started the dump operation that created the dump.

       clone date
	   For a backup or read-only volume, the time at which it was cloned from its read/write source. For a read/write volume, the same as the
	   value in the "creation date" field.

       tape name
	   The name of the tape containing the dump: either the permanent tape name, or an AFS tape name in the format
	   volume_set_name.dump_level_name.tape_index where volume_set_name is the name of the volume set associated with the initial dump in the
	   dump set of which this tape is a part; dump_level_name is the name of the dump level at which the initial dump was backed up;
	   tape_index is the ordinal of the tape in the dump set. Either type of name can be followed by a dump ID in parentheses; if it appears,
	   it is the dump ID of the initial dump in the dump set to which this appended dump belongs.

EXAMPLES
       The following example shows part of the dump history of the Backup volume "user.smith.backup":

	  % backup volinfo -volume user.smith.backup
	  DumpID    lvl parentID  creation date    clone date	    tape name
	  924600000 1	924427600 04/20/1999 05:20 04/20/1999 05:01 user_incr_2 (924514392)
	  924514392 1	924427600 04/19/1999 05:33 04/19/1999 05:08 user_incr_2
	  924427600 0		0 04/18/1999 05:26 04/18/1999 04:58 user_full_6
	      .     .	   .	     .	     .	     .	    .	      .
	      .     .	   .	     .	     .	     .	    .	      .

PRIVILEGE REQUIRED
       None

SEE ALSO
       backup(8), backup_dumpinfo(8), backup_volrestore(8)

COPYRIGHT
       IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.

       This documentation is covered by the IBM Public License Version 1.0.  It was converted from HTML to POD by software written by Chas
       Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.

OpenAFS 							    2012-03-26							 BACKUP_VOLINFO(8)
All times are GMT -4. The time now is 05:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy