Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # this is bash version of https://pastebin.com/w6Dt3ZeY
- papertrailkey=""
- now=`date +"%Y-%m-%d" -d "04/01/2019"`
- end=`date +"%Y-%m-%d" -d "05/01/2019"` #Must end +1 from the last date
- while [ "$now" != "$end" ] ;
- do
- hour=0
- counter=0
- while [ $hour -le 23 ]
- do
- hourformatted=$(printf "%02d" $hour)
- datetime="$now-$hourformatted"
- header="--header=X-Papertrail-Token: $papertrailkey"
- wget "$header" -O "$datetime.tsv.gz" "https://papertrailapp.com/api/v1/archives/$datetime/download" &
- if [ "1" = "$counter" ];
- then
- counter=0
- wait
- fi
- hour=$(( $hour + 1))
- counter=$(( $counter + 1))
- done
- now=`date +"%Y-%m-%d" -d "$now + 1 day"`;
- done
Add Comment
Please, Sign In to add comment