- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
PS-IPP-Config/lib/PS/IPP/Config.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/PS-IPP-Config/lib/PS/IPP/Config.pm
r31907 r33415 20 20 use Getopt::Long 2.33 qw( GetOptions :config gnu_getopt pass_through ); # Set pass_through so we don't kill @ARGV 21 21 use IPC::Cmd 0.36 qw( can_run run ); 22 use POSIX qw( strftime ); 22 23 23 24 use base qw( Exporter Class::Accessor::Fast ); … … 397 398 return $self->{nebulous} if defined $self->{nebulous}; # Already started 398 399 399 my $server = metadataLookupStr( $self->{_siteConfig}, 'NEB_SERVER' ); # Nebulous server 400 # For consistency with the rest of the IPP, don't use site.config 401 # to set NEB_SERVER use environment variable. 402 # my $server = metadataLookupStr( $self->{_siteConfig}, 'NEB_SERVER' ); # Nebulous server 403 my $server = $ENV{NEB_SERVER}; 400 404 unless (defined $server) { 401 405 carp "Unable to find NEB_SERVER in camera configuration file."; … … 692 696 } 693 697 698 699 694 700 # redirect stderr and stdout streams to a file 695 701 sub redirect_output … … 722 728 723 729 return 1; 730 } 731 732 # redirect stderr and stdout streams to log file. If file already exists rename it and record 733 # the name in the new log file. 734 sub redirect_to_logfile { 735 my $self = shift; 736 my $name = shift; 737 738 my $tstring = strftime "%Y%m%dT%H%M%S", gmtime; 739 740 my $old_name; 741 my $scheme = file_scheme($name); 742 if ($scheme and $scheme eq 'neb') { 743 my $neb = $self->nebulous; 744 if ($neb->storage_object_exists($name)) { 745 eval { 746 $old_name = "$name.$tstring"; 747 $neb->move($name, $old_name); 748 }; 749 if ($@) { 750 carp "nebulous move failed for $name"; 751 return undef; 752 } 753 } 754 } else { 755 if ($self->file_exists($name)) { 756 my $resolved = $self->file_resolve($name); 757 $old_name = "$resolved.$tstring"; 758 if (!rename($resolved, $old_name)) { 759 carp "Failed to rename $resolved $old_name"; 760 return undef; 761 } 762 } 763 } 764 my $result = $self->redirect_output($name); 765 if ($result and $old_name) { 766 print "\nPrevious log file moved to $old_name\n"; 767 } 768 return $result; 724 769 } 725 770
Note:
See TracChangeset
for help on using the changeset viewer.
