don't export empty files
[freeside.git] / bin / shell.export
index 3ccda35..146a0fd 100755 (executable)
@@ -8,6 +8,8 @@ use Net::SSH qw(ssh);
 use FS::UID qw(adminsuidsetup datasrc);
 use FS::Record qw(qsearch qsearchs);
 use FS::part_export;
+use FS::cust_svc;
+use FS::svc_acct;
 
 my @saltset = ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' );
 
@@ -26,9 +28,12 @@ my $rsync = File::Rsync->new({
 });
 
 foreach my $export ( @sysv_exports ) {
+}
+
+foreach my $export ( @bsd_exports ) {
   my $machine = $export->machine;
   my $prefix = "$spooldir/$machine";
-  mkdir $prefix unless -d $prefix;
+  mkdir $prefix, 0700 unless -d $prefix;
 
   #LOCKING!!!
 
@@ -49,6 +54,8 @@ foreach my $export ( @sysv_exports ) {
         grep { qsearch('cust_svc', { 'svcpart' => $_->svcpart } ) }
           $export->export_svc;
 
+  next unless @svc_acct;
+
   foreach my $svc_acct ( sort { $a->uid <=> $b->uid } @svc_acct ) {
 
     my $password = $svc_acct->_password;