sub ipsec_restart { my ($self) = @_; my $cmd = 'sudo -s ipsec restart'; my $restart = 0; $self->execute($cmd); foreach my $line ( @{ $self->get_stdout() } ) { if ( $line =~ /(Starting strongSwan.*IPsec$)/ ) { $restart = $1; last; } } return $restart; }