summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/breakdown-bill-applications25
-rwxr-xr-xbin/cdr_calltype.import41
-rwxr-xr-xbin/cdr_upstream_rate.import142
-rwxr-xr-xbin/customer-faker118
-rwxr-xr-xbin/dbdef-create5
-rwxr-xr-xbin/expand-country29
-rwxr-xr-xbin/fs-migrate-svc_acct_sm2
-rwxr-xr-xbin/generate-table-module1
-rwxr-xr-xbin/import-county-tax-rates30
-rwxr-xr-xbin/mapsecrets2access_user87
-rwxr-xr-xbin/payment-faker54
-rwxr-xr-xbin/pg-version13
-rwxr-xr-xbin/pod2x3
-rwxr-xr-xbin/populate-msgcat135
-rwxr-xr-xbin/rotate-cdrs38
-rw-r--r--bin/rt-update-links36
-rwxr-xr-xbin/svc_acct.export641
-rwxr-xr-xbin/svc_acct.import1
-rwxr-xr-xbin/svc_domain.erase2
19 files changed, 620 insertions, 783 deletions
diff --git a/bin/breakdown-bill-applications b/bin/breakdown-bill-applications
new file mode 100644
index 000000000..44c3e36b0
--- /dev/null
+++ b/bin/breakdown-bill-applications
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w
+
+use strict;
+use FS::UID qw(adminsuidsetup dbh);
+use FS::Record qw( qsearch );
+use FS::cust_bill_pay;
+use FS::cust_credit_bill;
+
+$FS::CurrentUser::upgrade_hack = 1;
+adminsuidsetup(shift) or die "Usage: breakdown-bill-applications username\n";
+
+#quick and dirty conversion script if you have enough memory to throw at it
+
+my @tables = qw( cust_bill_pay cust_credit_bill );
+
+my @apps = ();
+foreach my $table {
+ push @apps, qsearch($table,
+
+
+) {
+
+}
+
+foreach my $cust_bill_
diff --git a/bin/cdr_calltype.import b/bin/cdr_calltype.import
new file mode 100755
index 000000000..a998284f6
--- /dev/null
+++ b/bin/cdr_calltype.import
@@ -0,0 +1,41 @@
+#!/usr/bin/perl -w
+#
+# bin/cdr_calltype.import ivan ~ivan/convergent/newspecs/fixed_inbound/calltypes.csv
+
+use strict;
+use FS::UID qw(dbh adminsuidsetup);
+use FS::cdr_calltype;
+
+my $user = shift or die &usage;
+adminsuidsetup $user;
+
+while (<>) {
+
+ chomp;
+ my $line = $_;
+
+ #$line =~ /^(\d+),"([^"]+)"$/ or do {
+ $line =~ /^(\d+),"([^"]+)"/ or do {
+ warn "unparsable line: $line\n";
+ next;
+ };
+
+ my $cdr_calltype = new FS::cdr_calltype {
+ 'calltypenum' => $1,
+ 'calltypename' => $2,
+ };
+
+ #my $error = $cdr_calltype->check;
+ my $error = $cdr_calltype->insert;
+ if ( $error ) {
+ warn "********** $error FOR LINE: $line\n";
+ dbh->commit;
+ #my $wait = scalar(<STDIN>);
+ }
+
+}
+
+sub usage {
+ "Usage:\n\ncdr_calltype.import username filename ...\n";
+}
+
diff --git a/bin/cdr_upstream_rate.import b/bin/cdr_upstream_rate.import
new file mode 100755
index 000000000..fda3883b5
--- /dev/null
+++ b/bin/cdr_upstream_rate.import
@@ -0,0 +1,142 @@
+#!/usr/bin/perl -w
+#
+# Usage: bin/cdr_upstream_rate.import username ratenum filename
+#
+# records will be imported into cdr_upstream_rate, rate_detail and rate_region
+#
+# Example: bin/cdr_upstream_rate.import ivan 1 ~ivan/convergent/sample_rate_table.csv
+#
+# username: a freeside login (from /usr/local/etc/freeside/mapsecrets)
+# ratenum: rate plan (FS::rate) created with the web UI
+# filename: CSV file
+#
+# the following fields are currently used:
+# - Class Code => cdr_upstream_rate.rateid
+# - Description => rate_region.regionname
+# (rate_detail->dest_region)
+# - 1_rate => ( * 60 / 1_rate_seconds ) => rate_detail.min_charge
+# - 1_rate_seconds => (used above)
+# - 1_second_increment => rate_detail.sec_granularity
+#
+# the following fields are not (yet) used:
+# - Flagfall => what's this for?
+#
+# - 1_cap_time => freeside doesn't have voip time caps yet...
+# - 1_cap_cost => freeside doesn't have voip cost caps yet...
+# - 1_repeat => not sure what this is for, sample data is all 0
+#
+# - 2_rate => \
+# - 2_rate_seconds => |
+# - 2_second_increment => | not sure what the second set of rate data
+# - 2_cap_time => | is supposed to be for...
+# - 2_cap_cost => |
+# - 2_repeat => /
+#
+# - Carrier => probably not needed?
+# - Start Date => not necessary?
+
+use strict;
+use vars qw( $DEBUG );
+use Text::CSV_XS;
+use FS::UID qw(dbh adminsuidsetup);
+use FS::Record qw(qsearchs);
+use FS::rate;
+use FS::cdr_upstream_rate;
+use FS::rate_detail;
+use FS::rate_region;
+
+$DEBUG = 1;
+
+my $user = shift or die &usage;
+adminsuidsetup $user;
+
+my $ratenum = shift or die &usage;
+
+my $rate = qsearchs( 'rate', { 'ratenum' => $ratenum } );
+die "rate plan $ratenum not found in rate table\n"
+ unless $rate;
+
+my $csv = new Text::CSV_XS;
+my $hline = scalar(<>);
+chomp($hline);
+$csv->parse($hline) or die "can't parse header: $hline\n";
+my @header = $csv->fields();
+
+$FS::UID::AutoCommit = 0;
+
+while (<>) {
+
+ chomp;
+ my $line = $_;
+
+# #$line =~ /^(\d+),"([^"]+)"$/ or do {
+# #}
+# $line =~ /^(\d+),"([^"]+)"/ or do {
+# warn "unparsable line: $line\n";
+# next;
+# };
+
+ $csv->parse($line) or die "can't parse line: $line\n";
+ my @line = $csv->fields();
+
+ my %hash = map { $_ => shift(@line) } @header;
+
+ warn join('', map { "$_ => $hash{$_}\n" } keys %hash )
+ if $DEBUG > 1;
+
+ my $rate_region = new FS::rate_region {
+ 'regionname' => $hash{'Description'}
+ };
+
+ my $error = $rate_region->insert;
+ if ( $error ) {
+ dbh->rollback;
+ die "error inserting into rate_region: $error\n";
+ }
+ my $dest_regionnum = $rate_region->regionnum;
+ warn "rate_region $dest_regionnum inserted\n"
+ if $DEBUG;
+
+ my $rate_detail = new FS::rate_detail {
+ 'ratenum' => $ratenum,
+ 'dest_regionnum' => $dest_regionnum,
+ 'min_included' => 0,
+ #'min_charge', => sprintf('%.5f', 60 * $hash{'1_rate'} / $hash{'1_rate_seconds'} ),
+ 'min_charge', => sprintf('%.5f', $hash{'1_rate'} /
+ ( $hash{'1_rate_seconds'} / 60 )
+ ),
+ 'sec_granularity' => $hash{'1_second_increment'},
+ };
+ $error = $rate_detail->insert;
+ if ( $error ) {
+ dbh->rollback;
+ die "error inserting into rate_detail: $error\n";
+ }
+ my $ratedetailnum = $rate_detail->ratedetailnum;
+ warn "rate_detail $ratedetailnum inserted\n"
+ if $DEBUG;
+
+ my $cdr_upstream_rate = new FS::cdr_upstream_rate {
+ 'upstream_rateid' => $hash{'Class Code'},
+ 'ratedetailnum' => $rate_detail->ratedetailnum,
+ };
+ $error = $cdr_upstream_rate->insert;
+ if ( $error ) {
+ dbh->rollback;
+ die "error inserting into cdr_upstream_rate: $error\n";
+ }
+ warn "cdr_upstream_rate ". $cdr_upstream_rate->upstreamratenum. " inserted\n"
+ if $DEBUG;
+
+ dbh->commit or die "can't commit: ". dbh->errstr;
+
+ warn "\n" if $DEBUG;
+
+}
+
+dbh->commit or die "can't commit: ". dbh->errstr;
+
+sub usage {
+ "Usage:\n\ncdr_upstream_rate.import username ratenum filename\n";
+}
+
diff --git a/bin/customer-faker b/bin/customer-faker
new file mode 100755
index 000000000..b4032d1ec
--- /dev/null
+++ b/bin/customer-faker
@@ -0,0 +1,118 @@
+#!/usr/bin/perl
+
+use strict;
+use Getopt::Std;
+use Data::Faker;
+use Business::CreditCard;
+use FS::UID qw(adminsuidsetup);
+use FS::Record qw(qsearch);
+use FS::cust_main;
+use FS::cust_pkg;
+use FS::svc_acct;
+
+my $agentnum = 1;
+my $refnum = 1;
+
+#my @pkgs = ( 2, 3, 4 );
+my @pkgs = ( 4, 5, 6 );
+my $svcpart = 2;
+
+use vars qw( $opt_p );
+getopts('p:');
+
+my $user = shift or die &usage;
+my $num = shift or die &usage;
+adminsuidsetup($user);
+
+my $onum = $num;
+my $start = time;
+
+until ( $num-- <= 0 ) {
+
+ my $faker = new Data::Faker;
+
+ my $cust_main = new FS::cust_main {
+ 'agentnum' => $agentnum,
+ 'refnum' => $refnum,
+ 'first' => $faker->first_name,
+ 'last' => $faker->last_name,
+ 'company' => ( $num % 2 ? $faker->company. ', '. $faker->company_suffix : '' ), #half with companies..
+ 'address1' => $faker->street_address,
+ 'city' => 'Tofutown', #missing, so everyone is from tofutown# $faker->city,
+ 'state' => $faker->us_state_abbr,
+ 'zip' => $faker->us_zip_code,
+ 'country' => 'US',
+ 'daytime' => $faker->phone_number,
+ 'night' => $faker->phone_number,
+ #forget it, these can have extensions# 'fax' => ( $num % 2 ? $faker->phone_number : '' ), #ditto
+ #bah, forget shipping addresses
+ 'payby' => 'BILL',
+ 'payip' => $faker->ip_address,
+ };
+
+ if ( $opt_p eq 'CARD' || ( !$opt_p && rand() > .33 ) ) {
+ $cust_main->payby('CARD');
+ my $cardnum = '4123'. sprintf('%011u', int(rand(100000000000)) );
+ $cust_main->payinfo( $cardnum. generate_last_digit($cardnum) );
+ $cust_main->paydate( '2009-05-01' );
+ } elsif ( $opt_p eq 'CHEK' || ( !$opt_p && rand() > .66 ) ) {
+ $cust_main->payby('CHEK');
+ my $payinfo = sprintf('%7u@%09u', int(rand(10000000)), int(rand(1000000000)) );
+ $cust_main->payinfo($payinfo);
+ $cust_main->payname( 'First International Bank of Testing' );
+ }
+
+ # could insert invoicing_list and other stuff too.. hell, could insert
+ # packages, services, more
+ # but i just wanted 10k customers to test the pager and this was good enough
+ # not anymore, here's some services and packages
+
+ my $now = time;
+ my $year = 31556736; #60*60*24*365.24
+ my $setup = $now - int(rand($year));
+
+ my $cust_pkg = new FS::cust_pkg {
+ 'pkgpart' => $pkgs[ int(rand(scalar(@pkgs))) ],
+
+ #some dates in here would be nice
+ 'setup' => $setup,
+ #'last_bill'
+ #'bill'
+ #'susp'
+ #'expire'
+ #'cancel'
+ };
+
+ my $svc_acct = new FS::svc_acct {
+ 'svcpart' => $svcpart,
+ 'username' => $faker->username,
+ };
+
+ while ( qsearch( 'svc_acct', { 'username' => $svc_acct->username } ) ) {
+ my $username = $svc_acct->username;
+ $username++;
+ $svc_acct->username($username);
+ }
+
+ use Tie::RefHash;
+ tie my %hash, 'Tie::RefHash',
+ $cust_pkg => [ $svc_acct ],
+ ;
+
+ my $error = $cust_main->insert( \%hash );
+ die $error if $error;
+
+}
+
+my $end = time;
+
+my $sec = $end-$start;
+$sec=1 if $sec==0;
+my $persec = $onum / $sec;
+print "$onum customers inserted in $sec seconds ($persec customers/sec)\n";
+
+#---
+
+sub usage {
+ die "Usage:\n\n customer-faker [ -p payby ] user num_fakes\n";
+}
diff --git a/bin/dbdef-create b/bin/dbdef-create
index fea02c8c5..5063a3ce9 100755
--- a/bin/dbdef-create
+++ b/bin/dbdef-create
@@ -4,13 +4,16 @@ use strict;
use DBI;
use DBIx::DBSchema 0.26;
use FS::UID qw(adminsuidsetup datasrc driver_name);
+use FS::Schema;
my $user = shift or die &usage;
+$FS::Schema::setup_hack = 1;
+$FS::CurrentUser::upgrade_hack = 1;
my($dbh)=adminsuidsetup $user;
#needs to match FS::Record
-my($dbdef_file) = "/usr/local/etc/freeside/dbdef.". datasrc;
+my($dbdef_file) = "%%%FREESIDE_CONF%%%/dbdef.". datasrc;
my $dbdef = new_native DBIx::DBSchema $dbh;
diff --git a/bin/expand-country b/bin/expand-country
new file mode 100755
index 000000000..c6f2a1f09
--- /dev/null
+++ b/bin/expand-country
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Locale::SubCountry;
+use FS::UID qw(adminsuidsetup);
+use FS::Setup;
+use FS::Record qw(qsearch);
+use FS::cust_main_county;
+
+my $user = shift or die &usage;
+my $country = shift or die &usage;
+
+adminsuidsetup($user);
+
+my @country = qsearch('cust_main_county', { 'country' => $country } );
+die "unknown country $country" unless (@country);
+#die "$country already expanded" if scalar(@country) > 1;
+
+foreach my $cust_main_county ( @country ) {
+ my $error = $cust_main_county->delete;
+ die $error if $error;
+}
+
+FS::Setup::_add_country($country);
+
+sub usage {
+ die "Usage:\n\n expand-country user countrycode\n";
+}
+
diff --git a/bin/fs-migrate-svc_acct_sm b/bin/fs-migrate-svc_acct_sm
index e34b23596..07f7b611c 100755
--- a/bin/fs-migrate-svc_acct_sm
+++ b/bin/fs-migrate-svc_acct_sm
@@ -1,7 +1,5 @@
#!/usr/bin/perl -Tw
#
-# $Id: fs-migrate-svc_acct_sm,v 1.4 2002-06-21 09:13:16 ivan Exp $
-#
# jeff@cmh.net 01-Jul-20
#to delay loading dbdef until we're ready
diff --git a/bin/generate-table-module b/bin/generate-table-module
index fcc3f1d1f..b3204fa06 100755
--- a/bin/generate-table-module
+++ b/bin/generate-table-module
@@ -13,6 +13,7 @@ my %ut = ( #just guesses
'number' => 'float',
'varchar' => 'text',
'text' => 'text',
+ 'serial' => 'number',
);
my $dbdef_table = dbdef_dist->table($table)
diff --git a/bin/import-county-tax-rates b/bin/import-county-tax-rates
new file mode 100755
index 000000000..05798c9a2
--- /dev/null
+++ b/bin/import-county-tax-rates
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+#
+# import-county-tax-rates username state country <filename.csv
+# example: import-county-tax-rates ivan CA US <taxes.csv
+#
+# rates.csv: taxrate,county
+
+use FS::UID qw(adminsuidsetup);
+use FS::cust_main_county;
+
+my $user = shift;
+adminsuidsetup $user;
+
+my($state, $country) = (shift, shift);
+
+while (<>) {
+ my($tax, $county) = split(','); #half-ass CSV parser
+
+ my $cust_main_county = new FS::cust_main_county {
+ 'county' => $county,
+ 'state' => $state,
+ 'country' => $country,
+ 'tax' => $tax,
+ };
+
+ my $error = $cust_main_county->insert;
+ #my $error = $cust_main_county->check;
+ die $error if $error;
+
+}
diff --git a/bin/mapsecrets2access_user b/bin/mapsecrets2access_user
new file mode 100755
index 000000000..945f130ef
--- /dev/null
+++ b/bin/mapsecrets2access_user
@@ -0,0 +1,87 @@
+#!/usr/bin/perl -w
+
+use strict;
+use File::Copy "cp";
+use FS::UID qw(adminsuidsetup);
+use FS::CurrentUser;
+use FS::AccessRight;
+use FS::Record qw(qsearchs qsearch);
+use FS::access_group;
+use FS::access_user;
+use FS::access_usergroup;
+use FS::access_right;
+use FS::access_groupagent;
+use FS::agent;
+
+$FS::CurrentUser::upgrade_hack = 1;
+my $user = shift or die &usage;
+adminsuidsetup $user;
+
+my $supergroup = qsearchs('access_group', { 'groupname' => 'Superuser' } );
+unless ( $supergroup ) {
+
+ $supergroup = new FS::access_group { 'groupname' => 'Superuser' };
+ my $error = $supergroup->insert;
+ die $error if $error;
+
+ foreach my $rightname ( FS::AccessRight->rights ) {
+ my $access_right = new FS::access_right {
+ 'righttype' => 'FS::access_group',
+ 'rightobjnum' => $supergroup->groupnum,
+ 'rightname' => $rightname,
+ };
+ my $ar_error = $access_right->insert;
+ die $ar_error if $ar_error;
+ }
+
+ foreach my $agent ( qsearch('agent', {} ) ) {
+ my $access_groupagent = new FS::access_groupagent {
+ 'groupnum' => $supergroup->groupnum,
+ 'agentnum' => $agent->agentnum,
+ };
+ my $aga_error = $access_groupagent->insert;
+ die $aga_error if $aga_error;
+ }
+
+}
+my $supergroupnum = $supergroup->groupnum;
+
+my $conf = new FS::Conf;
+my $dir = $conf->base_dir;
+my $mapsecrets = "$dir/mapsecrets";
+open(MAPSECRETS, "<$mapsecrets") or die "Can't open $mapsecrets: $!";
+while (<MAPSECRETS>) {
+ /([\w]+)\s+secrets\s*$/ or die "unparsable line in mapsecrets: $_";
+ my $username = $1;
+
+ next if qsearchs('access_user', { 'username' => $username } );
+
+ my $access_user = new FS::access_user {
+ 'username' => $username,
+ '_password' => 'notyet',
+ 'first' => 'Legacy',
+ 'last' => 'User',
+ };
+ my $au_error = $access_user->insert;
+ die $au_error if $au_error;
+
+ my $access_usergroup = new FS::access_usergroup {
+ 'usernum' => $access_user->usernum,
+ 'groupnum' => $supergroupnum,
+ };
+ my $aug_error = $access_usergroup->insert;
+ die $aug_error if $aug_error;
+
+}
+close MAPSECRETS;
+
+# okay to clobber mapsecrets now i guess
+cp $mapsecrets, "$mapsecrets.bak$$";
+open(MAPSECRETS, ">$mapsecrets") or die $!;
+print MAPSECRETS '* secrets'. "\n";
+close MAPSECRETS or die $!;
+
+sub usage {
+ die "Usage:\n mapsecrets2access_user user\n";
+}
+
diff --git a/bin/payment-faker b/bin/payment-faker
new file mode 100755
index 000000000..03316e1c0
--- /dev/null
+++ b/bin/payment-faker
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+
+use Date::Parse;
+use FS::UID qw(adminsuidsetup);
+use FS::Record qw(qsearch);
+use FS::cust_pay;
+use FS::cust_credit;
+
+my $user;
+$user = shift or die "usage: payment-faker $user";
+adminsuidsetup($user);
+
+for $month ( 1 .. 11 ) {
+
+ print "month $month\n";
+
+ system(qq!freeside-daily -d "$month/1/2006" $user!);
+
+ foreach my $cust_main ( qsearch('cust_main', {} ) ) {
+ next unless $cust_main->balance > 0;
+ my $item = '';
+ if ( rand() > .95 ) {
+ $item = new FS::cust_credit {
+ 'amount' => $cust_main->balance,
+ '_date' => str2time("$month/1/2006"),
+ 'reason' => 'testing',
+ };
+ } else {
+
+ if ( rand() > .5 ) {
+ $payby = 'BILL';
+ $payinfo = int(rand(10000));
+ } else {
+ $payby = 'CARD';
+ $payinfo = '4111111111111111';
+ }
+
+ $item = new FS::cust_pay {
+ 'paid' => $cust_main->balance,
+ '_date' => str2time("$month/1/2006"),
+ 'payby' => $payby,
+ 'payinfo' => $payinfo,
+ };
+ }
+
+ $item->custnum($cust_main->custnum);
+ my $error = $item->insert;
+ die $error if $error;
+ $cust_main->apply_payments;
+ $cust_main->apply_credits;
+
+ }
+
+}
diff --git a/bin/pg-version b/bin/pg-version
new file mode 100755
index 000000000..b6cddb612
--- /dev/null
+++ b/bin/pg-version
@@ -0,0 +1,13 @@
+#!/usr/bin/perl -w
+
+use strict;
+use FS::UID qw(adminsuidsetup dbh);
+
+my $user = shift or die &usage;
+adminsuidsetup($user);
+
+print "pg_server_version: ". dbh->{'pg_server_version'}. "\n";
+
+sub usage {
+ "\n\nUsage: pg-version username\n";
+};
diff --git a/bin/pod2x b/bin/pod2x
index 46ccc7743..1e11c5699 100755
--- a/bin/pod2x
+++ b/bin/pod2x
@@ -30,7 +30,8 @@ foreach my $file (
glob("$site_perl/*/*/*.pm"),
glob("$site_perl/bin/*.pod"),
glob("./fs_sesmon/FS-SessionClient/*.pm"),
- glob("./fs_signup/FS-SignupClient/*.pm"),
+ #glob("./fs_signup/FS-SignupClient/*.pm"),
+ glob("./fs_selfservice/FS-SelfService/*.pm"),
glob("./fs_selfadmin/FS-MailAdminServer/*.pm"),
) {
next if $file =~ /(^|\/)blib\//;
diff --git a/bin/populate-msgcat b/bin/populate-msgcat
deleted file mode 100755
index adac92dd0..000000000
--- a/bin/populate-msgcat
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/perl -Tw
-
-use strict;
-use FS::UID qw(adminsuidsetup);
-use FS::Record qw(qsearch);
-use FS::msgcat;
-
-my $user = shift or die &usage;
-adminsuidsetup $user;
-
-foreach my $del_msgcat ( qsearch('msgcat', {}) ) {
- my $error = $del_msgcat->delete;
- die $error if $error;
-}
-
-my %messages = messages();
-
-foreach my $msgcode ( keys %messages ) {
- foreach my $locale ( keys %{$messages{$msgcode}} ) {
- my $msgcat = new FS::msgcat( {
- 'msgcode' => $msgcode,
- 'locale' => $locale,
- 'msg' => $messages{$msgcode}{$locale},
- });
- my $error = $msgcat->insert;
- die $error if $error;
- }
-}
-
-#print "Message catalog initialized sucessfully\n";
-
-sub messages {
-
- # 'msgcode' => {
- # 'en_US' => 'Message',
- # },
-
- (
-
- 'passwords_dont_match' => {
- 'en_US' => "Passwords don't match",
- },
-
- 'invalid_card' => {
- 'en_US' => 'Invalid credit card number',
- },
-
- 'unknown_card_type' => {
- 'en_US' => 'Unknown card type',
- },
-
- 'not_a' => {
- 'en_US' => 'Not a ',
- },
-
- 'empty_password' => {
- 'en_US' => 'Empty password',
- },
-
- 'no_access_number_selected' => {
- 'en_US' => 'No access number selected',
- },
-
- 'illegal_text' => {
- 'en_US' => 'Illegal (text)',
- #'en_US' => 'Only letters, numbers, spaces, and the following punctuation symbols are permitted: ! @ # $ % & ( ) - + ; : \' " , . ? / in field',
- },
-
- 'illegal_or_empty_text' => {
- 'en_US' => 'Illegal or empty (text)',
- #'en_US' => 'Only letters, numbers, spaces, and the following punctuation symbols are permitted: ! @ # $ % & ( ) - + ; : \' " , . ? / in required field',
- },
-
- 'illegal_username' => {
- 'en_US' => 'Illegal username',
- },
-
- 'illegal_password' => {
- 'en_US' => 'Illegal password (',
- },
-
- 'illegal_password_characters' => {
- 'en_US' => ' characters)',
- },
-
- 'username_in_use' => {
- 'en_US' => 'Username in use',
- },
-
- 'illegal_email_invoice_address' => {
- 'en_US' => 'Illegal email invoice address',
- },
-
- 'illegal_name' => {
- 'en_US' => 'Illegal (name)',
- #'en_US' => 'Only letters, numbers, spaces and the following punctuation symbols are permitted: , . - \' in field',
- },
-
- 'illegal_phone' => {
- 'en_US' => 'Illegal (phone)',
- #'en_US' => '',
- },
-
- 'illegal_zip' => {
- 'en_US' => 'Illegal (zip)',
- #'en_US' => '',
- },
-
- 'expired_card' => {
- 'en_US' => 'Expired card',
- },
-
- 'daytime' => {
- 'en_US' => 'Day Phone',
- },
-
- 'night' => {
- 'en_US' => 'Night Phone',
- },
-
- 'svc_external-id' => {
- 'en_US' => 'External ID',
- },
-
- 'svc_external-title' => {
- 'en_US' => 'Title',
- },
-
- );
-}
-
-sub usage {
- die "Usage:\n\n populate-msgcat user\n";
-}
-
diff --git a/bin/rotate-cdrs b/bin/rotate-cdrs
new file mode 100755
index 000000000..7bef0bbb0
--- /dev/null
+++ b/bin/rotate-cdrs
@@ -0,0 +1,38 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Fcntl qw(:flock);
+use IO::File;
+
+my $dir = '/usr/local/etc/freeside/export/cdr';
+#chdir $dir;
+
+#XXX glob might not handle lots of args at some point...
+foreach my $file ( glob("$dir/*/CDR*-spool.CSV") ) {
+
+ $file =~ m{(\d+)/CDR(\d+)-spool.CSV$}
+ or die "guru meditation #54: can't parse filename: $file\n";
+ my($custnum, $date) = ($1, $2);
+
+
+ my $alpha = 'A';
+ while ( -e "$dir/$custnum/CDR$date$alpha.CSV" ) {
+ $alpha++; # A -> Z -> AA etc.
+ }
+ my $newfile = "$dir/$custnum/CDR$date$alpha.CSV";
+
+ rename $file, $newfile
+ or die "$! moving $file to $newfile\n";
+
+ use IO::File;
+ my $lock = new IO::File ">>$newfile"
+ or die "can't open $newfile: $!\n";
+ sleep 1; #just in case. i guess there's still a *remotely* possible
+ #race condition, but i'm not losing any sleep over it... (rimshot)
+ flock($lock, LOCK_EX)
+ or die "can't lock $newfile: $!\n";
+ #okay we've got the lock, any pending write should be done...
+
+ print "$custnum: $newfile\n";
+
+}
diff --git a/bin/rt-update-links b/bin/rt-update-links
new file mode 100644
index 000000000..75d554f48
--- /dev/null
+++ b/bin/rt-update-links
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+use FS::UID qw(adminsuidsetup);
+
+my( $olddb, $newdb ) = ( shift, shift );
+
+$FS::CurrentUser::upgrade_hack = 1;
+my $dbh = adminsuidsetup;
+
+my $statement = "select * from links where base like 'fsck.com-rt://$olddb/%' OR target like 'fsck.com-rt://$olddb/%'";
+
+my $sth = $dbh->prepare($statement) or die $dbh->errstr;
+$sth->execute or die $sth->errstr;
+
+while ( my $row = $sth->fetchrow_hashref ) {
+
+ ( my $base = $row->{'base'} )
+ =~ s(^fsck\.com-rt://$olddb/)(fsck.com-rt://$newdb/);
+
+ ( my $target = $row->{'target'} )
+ =~ s(^fsck\.com-rt://$olddb/)(fsck.com-rt://$newdb/);
+
+ if ( $row->{'base'} ne $base || $row->{'target'} ne $target ) {
+
+ my $update = 'UPDATE links SET base = ?, target = ? where id = ?';
+ my @param = ( $base, $target, $row->{'id'} );
+
+ warn "$update : ". join(', ', @param). "\n";
+ $dbh->do($update, {}, @param );
+
+ }
+
+}
+
+$dbh->commit;
+
diff --git a/bin/svc_acct.export b/bin/svc_acct.export
deleted file mode 100755
index 0bc370fc0..000000000
--- a/bin/svc_acct.export
+++ /dev/null
@@ -1,641 +0,0 @@
-#!/usr/bin/perl -w
-#
-# $Id: svc_acct.export,v 1.36 2002-05-16 14:28:35 ivan Exp $
-#
-# Create and export password, radius and vpopmail password files:
-# passwd, passwd.adjunct, shadow, acp_passwd, acp_userinfo, acp_dialup
-# users/assign, domains/vdomain/vpasswd
-# Also export sendmail and qmail config files.
-
-use strict;
-use vars qw($conf);
-use Fcntl qw(:flock);
-use File::Path;
-use IO::Handle;
-use FS::Conf;
-use Net::SSH qw(ssh);
-use Net::SCP qw(scp);
-use FS::UID qw(adminsuidsetup datasrc dbh);
-use FS::Record qw(qsearch qsearchs fields);
-use FS::svc_acct;
-use FS::svc_domain;
-use FS::svc_forward;
-
-my $ssh='ssh';
-my $rsync='rsync';
-
-my $user = shift or die &usage;
-adminsuidsetup $user;
-
-$conf = new FS::Conf;
-
-my $userpolicy = $conf->config('username_policy')
- if $conf->exists('username_policy');
-
-my @shellmachines = $conf->config('shellmachines')
- if $conf->exists('shellmachines');
-
-my @bsdshellmachines = $conf->config('bsdshellmachines')
- if $conf->exists('bsdshellmachines');
-
-my @nismachines = $conf->config('nismachines')
- if $conf->exists('nismachines');
-
-my @erpcdmachines = $conf->config('erpcdmachines')
- if $conf->exists('erpcdmachines');
-
-my @radiusmachines = $conf->config('radiusmachines')
- if $conf->exists('radiusmachines');
-
-my $textradiusprepend =
- $conf->exists('textradiusprepend')
- ? $conf->config('textradiusprepend')
- : '';
-
-warn "using depriciated textradiusprepend file" if $textradiusprepend;
-
-
-my $radiusprepend =
- $conf->exists('radiusprepend')
- ? join("\n", $conf->config('radiusprepend'))
- : '';
-
-my @vpopmailmachines = $conf->config('vpopmailmachines')
- if $conf->exists('vpopmailmachines');
-my $vpopmailrestart = '';
-$vpopmailrestart = $conf->config('vpopmailrestart')
- if $conf->exists('vpopmailrestart');
-
-my ($machine, $vpopdir, $vpopuid, $vpopgid) = split (/\s+/, $vpopmailmachines[0]) if $vpopmailmachines[0];
-
-my($shellmachine, @qmailmachines);
-if ( $conf->exists('qmailmachines') ) {
- $shellmachine = $conf->config('shellmachine');
- @qmailmachines = $conf->config('qmailmachines');
-}
-
-my(@sendmailmachines, $sendmailconfigpath, $sendmailrestart);
-if ( $conf->exists('sendmailmachines') ) {
- @sendmailmachines = $conf->config('sendmailmachines');
- $sendmailconfigpath = $conf->config('sendmailconfigpath') || '/etc';
- $sendmailrestart = $conf->config('sendmailrestart');
-}
-
-my $mydomain = $conf->config('domain') if $conf->exists('domain');
-
-
-
-
-my(@saltset)= ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' );
-require 5.004; #srand(time|$$);
-
-my $spooldir = "/usr/local/etc/freeside/export.". datasrc;
-my $spoollock = "/usr/local/etc/freeside/svc_acct.export.lock.". datasrc;
-
-open(EXPORT,"+>>$spoollock") or die "Can't open $spoollock: $!";
-select(EXPORT); $|=1; select(STDOUT);
-unless ( flock(EXPORT,LOCK_EX|LOCK_NB) ) {
- seek(EXPORT,0,0);
- my($pid)=<EXPORT>;
- chop($pid);
- #no reason to start lots of blocking processes
- die "Is another export process running under pid $pid?\n";
-}
-seek(EXPORT,0,0);
-print EXPORT $$,"\n";
-
-my(@svc_domain)=qsearch('svc_domain',{});
-
-( open(MASTER,">$spooldir/master.passwd")
- and flock(MASTER,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/.master.passwd: $!";
-( open(PASSWD,">$spooldir/passwd")
- and flock(PASSWD,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/passwd: $!";
-( open(SHADOW,">$spooldir/shadow")
- and flock(SHADOW,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/shadow: $!";
-( open(ACP_PASSWD,">$spooldir/acp_passwd")
- and flock(ACP_PASSWD,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/acp_passwd: $!";
-( open(ACP_DIALUP,">$spooldir/acp_dialup")
- and flock(ACP_DIALUP,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/acp_dialup: $!";
-( open(USERS,">$spooldir/users")
- and flock(USERS,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/users: $!";
-
-( open(ASSIGN,">$spooldir/assign")
- and flock(ASSIGN,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/assign: $!";
-( open(RCPTHOSTS,">$spooldir/rcpthosts")
- and flock(RCPTHOSTS,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/rcpthosts: $!";
-( open(VPOPRCPTHOSTS,">$spooldir/vpoprcpthosts")
- and flock(VPOPRCPTHOSTS,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/rcpthosts: $!";
-( open(RECIPIENTMAP,">$spooldir/recipientmap")
- and flock(RECIPIENTMAP,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/recipientmap: $!";
-( open(VIRTUALDOMAINS,">$spooldir/virtualdomains")
- and flock(VIRTUALDOMAINS,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/virtualdomains: $!";
-( open(VPOPVIRTUALDOMAINS,">$spooldir/vpopvirtualdomains")
- and flock(VPOPVIRTUALDOMAINS,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/virtualdomains: $!";
-( open(VIRTUSERTABLE,">$spooldir/virtusertable")
- and flock(VIRTUSERTABLE,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/virtusertable: $!";
-( open(SENDMAIL_CW,">$spooldir/sendmail.cw")
- and flock(SENDMAIL_CW,LOCK_EX|LOCK_NB)
-) or die "Can't open $spooldir/sendmail.cw: $!";
-
-
-
-chmod 0644, "$spooldir/passwd",
- "$spooldir/acp_dialup",
- "$spooldir/assign",
- "$spooldir/sendmail.cw",
- "$spooldir/virtusertable",
- "$spooldir/rcpthosts",
- "$spooldir/vpoprcpthosts",
- "$spooldir/recipientmap",
- "$spooldir/virtualdomains",
- "$spooldir/vpopvirtualdomains",
-
-;
-chmod 0600, "$spooldir/master.passwd",
- "$spooldir/acp_passwd",
- "$spooldir/shadow",
- "$spooldir/users",
-;
-
-rmtree"$spooldir/domains", 0, 1;
-mkdir "$spooldir/domains", 0700;
-
-setpriority(0,0,10);
-
-print USERS "$radiusprepend\n";
-
-my %usernames; ## this hack helps keep the passwd files sane
-my @sendmail;
-
-my $svc_domain;
-foreach $svc_domain (sort {$a->domain cmp $b->domain} @svc_domain) {
-
- my($domain)=$svc_domain->domain;
- print RCPTHOSTS "$domain\n.$domain\n";
- print VPOPRCPTHOSTS "$domain\n";
- print SENDMAIL_CW "$domain\n";
-
- ###
- # FORMAT OF THE ASSIGN/USERS FILE HERE
- print ASSIGN join(":",
- "+" . $domain . "-",
- $domain,
- $vpopuid,
- $vpopgid,
- $vpopdir . "/domains/" . $domain,
- "-",
- "",
- "",
- ), "\n" if $vpopmailmachines[0];
-
- (mkdir "$spooldir/domains/" . $domain, 0700)
- or die "Can't create $spooldir/domains/" . $domain .": $!";
-
- ( open(QMAILDEFAULT,">$spooldir/domains/" . $domain . "/.qmail-default")
- and flock(QMAILDEFAULT,LOCK_EX|LOCK_NB)
- ) or die "Can't open $spooldir/domains/" . $domain . "/.qmail-default: $!";
-
- ( open(VPASSWD,">$spooldir/domains/" . $domain . "/vpasswd")
- and flock(VPASSWD,LOCK_EX|LOCK_NB)
- ) or die "Can't open $spooldir/domains/" . $domain . "/vpasswd: $!";
-
- my ($svc_acct);
-
- if ($svc_domain->getfield('catchall')) {
- $svc_acct = qsearchs('svc_acct', {'svcnum' => $svc_domain->catchall});
- die "Cannot find catchall account for domain $domain\n" unless $svc_acct;
-
- my $username = $svc_acct->username;
- push @sendmail, "\@$domain\t$username\n";
- print VIRTUALDOMAINS "$domain:$username-$domain\n",
- ".$domain:$username-$domain\n",
- ;
-
- ###
- # FORMAT OF THE .QMAIL-DEFAULT FILE HERE
- print QMAILDEFAULT "| $vpopdir/bin/vdelivermail \"\" " . $svc_acct->email . "\n"
- if $vpopmailmachines[0];
-
- }else{
- ###
- # FORMAT OF THE .QMAIL-DEFAULT FILE HERE
- print QMAILDEFAULT "| $vpopdir/bin/vdelivermail \"\" bounce-no-mailbox\n"
- if $vpopmailmachines[0];
- }
-
- print VPOPVIRTUALDOMAINS "$domain:$domain\n";
-
- foreach $svc_acct (qsearch('svc_acct', {'domsvc' => $svc_domain->svcnum})) {
- my($password)=$svc_acct->getfield('_password');
- my($cpassword,$rpassword);
- #if ( ( length($password) <= 8 )
- if ( ( length($password) <= 12 )
- && ( $password ne '*' )
- && ( $password ne '!!' )
- && ( $password ne '' )
- ) {
- $cpassword=crypt($password,
- $saltset[int(rand(64))].$saltset[int(rand(64))]
- );
- $rpassword=$password;
- } else {
- $cpassword=$password;
- $rpassword='UNIX';
- }
-
- my $username;
-
- if ($mydomain && ($mydomain eq $svc_domain->domain)) {
- $username=$svc_acct->username;
- } elsif ($userpolicy =~ /^prepend domsvc$/) {
- $username=$svc_acct->domsvc . $svc_acct->username;
- } elsif ($userpolicy =~ /^append domsvc$/) {
- $username=$svc_acct->username . $svc_acct->domsvc;
- } elsif ($userpolicy =~ /^append domain$/) {
- $username=$svc_acct->username . $svc_domain->domain;
- } elsif ($userpolicy =~ /^append domain$/) {
- $username=$svc_acct->username . $svc_domain->domain;
- } elsif ($userpolicy =~ /^append \@domain$/) {
- $username=$svc_acct->username . '@'. $svc_domain->domain;
- } else {
- die "Unknown policy in username_policy\n";
- }
-
- if ($svc_acct->dir ne '/dev/null' || $svc_acct->slipip ne '') {
- if ($usernames{$username}++) {
- die "Duplicate username detected: $username\n";
- }
- }
-
- if ( $svc_acct->uid =~ /^(\d+)$/ ) {
-
- die "Non-root user ". $svc_acct->username. " has 0 UID!"
- if $svc_acct->uid == 0 && $svc_acct->username ne 'root';
-
- if ( $svc_acct->dir ne "/dev/null") {
-
- ###
- # FORMAT OF FreeBSD MASTER PASSWD FILE HERE
- print MASTER join(":",
- $username, # User name
- $cpassword, # Encrypted password
- $svc_acct->uid, # User ID
- $svc_acct->gid, # Group ID
- "", # Login Class
- "0", # Password Change Time
- "0", # Password Expiration Time
- $svc_acct->finger, # Users name
- $svc_acct->dir, # Users home directory
- $svc_acct->shell, # shell
- ), "\n" ;
-
-
- ###
- # FORMAT OF THE PASSWD FILE HERE
- print PASSWD join(":",
- $username,
- 'x', # "##". $username,
- $svc_acct->uid,
- $svc_acct->gid,
- $svc_acct->finger,
- $svc_acct->dir,
- $svc_acct->shell,
- ), "\n";
-
- ###
- # FORMAT OF THE SHADOW FILE HERE
- print SHADOW join(":",
- $username,
- $cpassword,
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- ), "\n";
- }
- }
-
- ###
- # FORMAT OF THE VPASSWD FILE HERE
- print VPASSWD join(":",
- $svc_acct->username,
- $cpassword,
- '1',
- '0',
- $svc_acct->username,
- "$vpopdir/domains/" . $svc_domain->domain ."/" . $svc_acct->username,
- 'NOQUOTA',
- ), "\n";
-
-
- if ( $svc_acct->slipip ne '' ) {
-
- ###
- # FORMAT OF THE ACP_* FILES HERE
- print ACP_PASSWD join(":",
- $username,
- $cpassword,
- "0",
- "0",
- "",
- "",
- "",
- ), "\n";
-
- my($ip)=$svc_acct->slipip;
-
- unless ( $ip eq '0.0.0.0' || $svc_acct->slipip eq '0e0' ) {
- print ACP_DIALUP $username, "\t*\t", $svc_acct->slipip, "\n";
- }
-
- my %radreply = $svc_acct->radius_reply;
- my %radcheck = $svc_acct->radius_check;
-
- my $radcheck = join ", ", map { qq($_ = "$radcheck{$_}") } keys %radcheck;
- $radcheck .= ", " if $radcheck;
-
- ###
- # FORMAT OF THE USERS FILE HERE
- print USERS
- $username,
- qq(\t${textradiusprepend}),
- $radcheck,
-# qq(Password = "$rpassword"\n\t),
- join ",\n\t", map { qq($_ = "$radreply{$_}") } keys %radreply;
-
- #if ( $ip && $ip ne '0e0' ) {
- # #print USERS qq(,\n\tFramed-Address = "$ip"\n\n);
- # print USERS qq(,\n\tFramed-IP-Address = "$ip"\n\n);
- #} else {
- print USERS qq(\n\n);
- #}
-
- }
-
- ###
- # vpopmail directory structure creation
-
- (mkdir "$spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username, 0700)
- or die "Can't create $spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username . ": $!";
- (mkdir "$spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username . "/Maildir", 0700)
- or die "Can't create $spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username . " /Maildir: $!";
- (mkdir "$spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username . "/Maildir/cur", 0700)
- or die "Can't create $spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username . " /Maildir/cur: $!";
- (mkdir "$spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username . "/Maildir/new", 0700)
- or die "Can't create $spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username . " /Maildir/new: $!";
- (mkdir "$spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username . "/Maildir/tmp", 0700)
- or die "Can't create $spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username . " /Maildir/tmp: $!";
-
- ( open(DOTQMAIL,">$spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username . "/.qmail")
- and flock(DOTQMAIL,LOCK_EX|LOCK_NB)
- ) or die "Can't open $spooldir/domains/" . $svc_domain->domain . "/" . $svc_acct->username . "/.qmail: $!";
-
- my($svc_forward);
- foreach $svc_forward (qsearch('svc_forward', {'srcsvc' => $svc_acct->svcnum})) {
- my($destination);
- if ($svc_forward->dstsvc) {
- my $dst_acct = qsearchs('svc_acct', {'svcnum' => $svc_forward->dstsvc});
- my $dst_domain = qsearchs('svc_domain', {'svcnum' => $dst_acct->domsvc});
- $destination = $dst_acct->username . '@' . $dst_domain->domain;
-
- if ($dst_domain->domain eq $mydomain) {
- print VIRTUSERTABLE $svc_acct->username . "@" . $svc_domain->domain .
- "\t" . $dst_acct->username . "\n";
- print RECIPIENTMAP $svc_acct->username . "@" . $svc_domain->domain .
- ":$destination\n";
- }
- } else {
- $destination = $svc_forward->dst;
- }
-
- ###
- # FORMAT OF .QMAIL FILES HERE
- print DOTQMAIL "$destination\n";
- }
-
- flock(DOTQMAIL,LOCK_UN);
- close DOTQMAIL;
-
- }
-
- flock(VPASSWD,LOCK_UN);
- flock(QMAILDEFAULT,LOCK_UN);
- close VPASSWD;
- close QMAILDEFAULT;
-
-}
-
-###
-# FORMAT OF THE ASSIGN/USERS FILE FINAL LINE HERE
-print ASSIGN ".\n";
-
-print VIRTUSERTABLE @sendmail;
-
-flock(MASTER,LOCK_UN);
-flock(PASSWD,LOCK_UN);
-flock(SHADOW,LOCK_UN);
-flock(ACP_DIALUP,LOCK_UN);
-flock(ACP_PASSWD,LOCK_UN);
-flock(USERS,LOCK_UN);
-flock(ASSIGN,LOCK_UN);
-flock(SENDMAIL_CW,LOCK_UN);
-flock(VIRTUSERTABLE,LOCK_UN);
-flock(RCPTHOSTS,LOCK_UN);
-flock(VPOPRCPTHOSTS,LOCK_UN);
-flock(RECIPIENTMAP,LOCK_UN);
-flock(VPOPVIRTUALDOMAINS,LOCK_UN);
-
-close MASTER;
-close PASSWD;
-close SHADOW;
-close ACP_DIALUP;
-close ACP_PASSWD;
-close USERS;
-close ASSIGN;
-close SENDMAIL_CW;
-close VIRTUSERTABLE;
-close RCPTHOSTS;
-close VPOPRCPTHOSTS;
-close RECIPIENTMAP;
-close VPOPVIRTUALDOMAINS;
-
-###
-# export stuff
-#
-
-my($ashellmachine);
-foreach $ashellmachine (@shellmachines) {
- my $scp = new Net::SCP;
- $scp->scp("$spooldir/passwd","root\@$ashellmachine:/etc/passwd.new")
- or die "scp error: ". $scp->{errstr};
- $scp->scp("$spooldir/shadow","root\@$ashellmachine:/etc/shadow.new")
- or die "scp error: ". $scp->{errstr};
- ssh("root\@$ashellmachine",
- "( ".
- "mv /etc/passwd.new /etc/passwd; ".
- "mv /etc/shadow.new /etc/shadow; ".
- " )"
- )
- == 0 or die "ssh error: $!";
-}
-
-my($bsdshellmachine);
-foreach $bsdshellmachine (@bsdshellmachines) {
- my $scp = new Net::SCP;
- $scp->scp("$spooldir/passwd","root\@$bsdshellmachine:/etc/passwd.new")
- or die "scp error: ". $scp->{errstr};
- $scp->scp("$spooldir/master.passwd","root\@$bsdshellmachine:/etc/master.passwd.new")
- or die "scp error: ". $scp->{errstr};
- ssh("root\@$bsdshellmachine",
- "( ".
- "mv /etc/passwd.new /etc/passwd; ".
- #"mv /etc/master.passwd.new /etc/master.passwd; ".
- "pwd_mkdb /etc/master.passwd.new; ".
- " )"
- )
- == 0 or die "ssh error: $!";
-}
-
-my($nismachine);
-foreach $nismachine (@nismachines) {
- my $scp = new Net::SCP;
- $scp->scp("$spooldir/passwd","root\@$nismachine:/etc/global/passwd")
- or die "scp error: ". $scp->{errstr};
- $scp->scp("$spooldir/shadow","root\@$nismachine:/etc/global/shadow")
- or die "scp error: ". $scp->{errstr};
- ssh("root\@$nismachine",
- "( ".
- "cd /var/yp; make; ".
- " )"
- )
- == 0 or die "ssh error: $!";
-}
-
-my($erpcdmachine);
-foreach $erpcdmachine (@erpcdmachines) {
- my $scp = new Net::SCP;
- $scp->scp("$spooldir/acp_passwd","root\@$erpcdmachine:/usr/annex/acp_passwd")
- or die "scp error: ". $scp->{errstr};
- $scp->scp("$spooldir/acp_dialup","root\@$erpcdmachine:/usr/annex/acp_dialup")
- or die "scp error: ". $scp->{errstr};
- ssh("root\@$erpcdmachine",
- "( ".
- "kill -USR1 \`cat /usr/annex/erpcd.pid\'".
- " )"
- )
- == 0 or die "ssh error: $!";
-}
-
-my($radiusmachine);
-foreach $radiusmachine (@radiusmachines) {
- my $scp = new Net::SCP;
- $scp->scp("$spooldir/users","root\@$radiusmachine:/etc/raddb/users")
- or die "scp error: ". $scp->{errstr};
- ssh("root\@$radiusmachine",
- "( ".
- "builddbm".
- " )"
- )
- == 0 or die "ssh error: $!";
-}
-
-#my @args = ("/bin/tar", "c", "--force-local", "-C", "$spooldir", "-f", "$spooldir/vpoptarball", "domains");
-
-#system {$args[0]} @args;
-
-my($vpopmailmachine);
-foreach $vpopmailmachine (@vpopmailmachines) {
- my ($machine, $vpopdir, $vpopuid, $vpopgid) = split (/\s+/, $vpopmailmachine);
- my $scp = new Net::SCP;
-# $scp->scp("$spooldir/vpoptarball","root\@$machine:vpoptarball")
-# or die "scp error: ". $scp->{errstr};
-# ssh("root\@$machine",
-# "( ".
-# "rm -rf domains; ".
-# "tar xf vpoptarball; ".
-# "chown -R $vpopuid:$vpopgid domains; ".
-# "tar cf vpoptarball domains; ".
-# "cd $vpopdir; ".
-# "tar xf ~/vpoptarball; ".
-# " )"
-# )
-# == 0 or die "ssh error: $!";
-
- chdir $spooldir;
- my @args = ("$rsync", "-rlpt", "-e", "$ssh", "domains/", "vpopmail\@$machine:$vpopdir/domains/");
-
- system {$args[0]} @args;
-
- $scp->scp("$spooldir/assign","root\@$machine:/var/qmail/users/assign")
- or die "scp error: ". $scp->{errstr};
- $scp->scp("$spooldir/vpopvirtualdomains","root\@$machine:/var/qmail/control/virtualdomains")
- or die "scp error: ". $scp->{errstr};
- $scp->scp("$spooldir/vpoprcpthosts","root\@$machine:/var/qmail/control/rcpthosts")
- or die "scp error: ". $scp->{errstr};
-
- ssh("root\@$machine",
- "( ".
- $vpopmailrestart .
- " )"
- )
- == 0 or die "ssh error: $!";
-
-
-}
-
-my($sendmailmachine);
-foreach $sendmailmachine (@sendmailmachines) {
- my $scp = new Net::SCP;
- $scp->scp("$spooldir/sendmail.cw","root\@$sendmailmachine:$sendmailconfigpath/sendmail.cw.new")
- or die "scp error: ". $scp->{errstr};
- $scp->scp("$spooldir/virtusertable","root\@$sendmailmachine:$sendmailconfigpath/virtusertable.new")
- or die "scp error: ". $scp->{errstr};
- ssh("root\@$sendmailmachine",
- "( ".
- "mv $sendmailconfigpath/sendmail.cw.new $sendmailconfigpath/sendmail.cw; ".
- "mv $sendmailconfigpath/virtusertable.new $sendmailconfigpath/virtusertable; ".
- $sendmailrestart.
- " )"
- )
- == 0 or die "ssh error: $!";
-}
-
-my($qmailmachine);
-foreach $qmailmachine (@qmailmachines) {
- my $scp = new Net::SCP;
- $scp->scp("$spooldir/recipientmap","root\@$qmailmachine:/var/qmail/control/recipientmap")
- or die "scp error: ". $scp->{errstr};
- $scp->scp("$spooldir/virtualdomains","root\@$qmailmachine:/var/qmail/control/virtualdomains")
- or die "scp error: ". $scp->{errstr};
- $scp->scp("$spooldir/rcpthosts","root\@$qmailmachine:/var/qmail/control/rcpthosts")
- or die "scp error: ". $scp->{errstr};
- #ssh("root\@$qmailmachine","/etc/init.d/qmail restart")
- # == 0 or die "ssh error: $!";
-}
-
-unlink $spoollock;
-flock(EXPORT,LOCK_UN);
-close EXPORT;
-
-#
-
-sub usage {
- die "Usage:\n\n svc_acct.export user\n";
-}
-
diff --git a/bin/svc_acct.import b/bin/svc_acct.import
index eb94e1c37..aff26b943 100755
--- a/bin/svc_acct.import
+++ b/bin/svc_acct.import
@@ -1,5 +1,4 @@
#!/usr/bin/perl -Tw
-# $Id: svc_acct.import,v 1.17 2001-08-19 10:25:44 ivan Exp $
use strict;
use vars qw(%part_svc);
diff --git a/bin/svc_domain.erase b/bin/svc_domain.erase
index c0236614b..435dd5fdd 100755
--- a/bin/svc_domain.erase
+++ b/bin/svc_domain.erase
@@ -1,6 +1,4 @@
#!/usr/bin/perl -w
-#
-# $Id: svc_domain.erase,v 1.1 2002-04-20 11:57:35 ivan Exp $
use strict;
use FS::UID qw(adminsuidsetup);