25 lines
470 B
Perl
25 lines
470 B
Perl
package Cualsea::Server::Service;
|
|
|
|
use v5.30.0;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
sub is_started_service {
|
|
my $name = shift;
|
|
return !system "/etc/init.d/$name", 'status';
|
|
}
|
|
|
|
sub check_if_service_exists_in_db {
|
|
my $name = shift;
|
|
my $dbh = Cualsea::Server::DB->dbh();
|
|
my $service = $dbh->selectrow_hashref( <<"EOF", undef, $name );
|
|
SELECT name FROM services WHERE name = ?
|
|
EOF
|
|
if ( !defined $service ) {
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
1;
|