| 126 |
- |
1 |
#!/usr/bin/perl
|
|
|
2 |
|
|
|
3 |
use strict;
|
|
|
4 |
use Net::Google::Drive::Simple;
|
|
|
5 |
#use Data::Dumper;
|
|
|
6 |
#use Log::Log4perl qw(:easy);
|
|
|
7 |
#Log::Log4perl->easy_init($DEBUG);
|
|
|
8 |
#Log::Log4perl->easy_init($ERROR);
|
|
|
9 |
|
|
|
10 |
my $gd = Net::Google::Drive::Simple->new();
|
|
|
11 |
|
|
|
12 |
my $fileId = '1J-b8fKHcJti8yQrQcmmHlTA-ZV8_o0iLwN-BW6zB9Z8'; # Events.com shared fileid
|
|
|
13 |
|
|
|
14 |
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
|
|
|
15 |
my $date = sprintf ( "%04d%02d%02d", $year+1900,$mon+1,$mday);
|
|
|
16 |
my $name = "files/RollerCon_MVP_Tickets.${date}.csv";
|
|
|
17 |
my $file = 'https://docs.google.com/spreadsheets/export?id='.$fileId.'&exportFormat=csv';
|
|
|
18 |
|
|
|
19 |
print "Today is $date.\n";
|
|
|
20 |
print "Fetching the google sheet (csv)...\n";
|
|
|
21 |
$gd->download( $file, $name ) or die "failed: $!";
|
|
|
22 |
print "Uploading file to prod server...\n";
|
|
|
23 |
system "/usr/bin/scp $name rollerco\@volunteers.rollercon.com:~/RCUtil/MVPTix/ 2>&1";
|