1 package FS::part_export::shellcommands;
6 @ISA = qw(FS::part_export);
12 $self->_export_command('useradd', @_);
17 $self->_export_command('userdel', @_);
21 my ( $self, $action, $svc_acct) = (shift, shift, shift);
22 my $command = $self->option($action);
23 my $stdin = $self->option($action."_stdin");
25 ${$_} = $svc_acct->getfield($_) foreach $svc_acct->fields;
26 $self->shellcommands_queue( $svc_acct->svcnum,
27 user => $self->options('user')||'root',
28 host => $self->options('machine'),
29 command => eval(qq("$command")),
30 stdin_string => eval(qq("$stdin")),
35 my($self, $new, $old ) = (shift, shift, shift);
36 my $command = $self->option('usermod');
37 my $stdin = $self->option('usermod_stdin');
39 ${"old_$_"} = $old->getfield($_) foreach $old->fields;
40 ${"new_$_"} = $new->getfield($_) foreach $new->fields;
41 $self->shellcommands_queue( $new->svcnum,
42 user => $self->options('user')||'root',
43 host => $self->options('machine'),
44 command => eval(qq("$command")),
45 stdin_string => eval(qq("$stdin")),
49 #a good idea to queue anything that could fail or take any time
50 sub shellcommands_queue {
51 my( $self, $svcnum ) = (shift, shift);
52 my $queue = new FS::queue {
54 'job' => "FS::part_export::shellcommands::ssh_cmd",
59 sub ssh_cmd { #subroutine, not method
61 &Net::SSH::ssh_cmd( { @_ } );
64 #sub shellcommands_insert { #subroutine, not method
66 #sub shellcommands_replace { #subroutine, not method
68 #sub shellcommands_delete { #subroutine, not method