Difference between revisions of "Systemd-control"

From SME Server
Jump to navigationJump to search
(Create Page)
 
 
Line 24: Line 24:
 
<!-- keep this first element as is, you can add some if needed -->
 
<!-- keep this first element as is, you can add some if needed -->
 
{{#smeversion: {{#var:smecontribname}} }}
 
{{#smeversion: {{#var:smecontribname}} }}
{{#smeversion: {{#var:contribname}} }}
 
  
 
=== Description ===
 
=== Description ===

Latest revision as of 06:04, 1 November 2021




systemd-control
NeedImage.svg
systemd-control logo
MaintainerJohn Crisp
Urlhttps://wiki.koozali.org
LicenceGPL v2
Category

Contrib Developer

Tags contrib'developerperl


Maintainer

John Crisp

Version

Contrib 10:
smeserver-systemd-control
The latest version of smeserver-systemd-control is available in the SME repository, click on the version number(s) for more information.


Description

Manage systemd services via perl.

Shamelessly copied from Nethesis.

This module adds some systemd checks and commands for services https://github.com/NethServer/nethserver-lib/blob/master/lib/perl/NethServer/Service.pm https://raw.githubusercontent.com/NethServer/nethserver-lib/master/lib/perl/NethServer/Service.pm


Installation

yum --enablerepo=smecontribs install smeserver-systemd-control
Not available

Configuration

There are no configuration entries

This module provides the following functions:

  1. new
  2. start
  3. stop
  4. condrestart
  5. restart
  6. reload
  7. is_configured
  8. is_enabled
  9. is_owned
  10. is_running
  11. is_masked
  12. adjust
  13. get_name

Test file is here:

/usr/local/bin/systemdcontrol-test.pl

Sample code:

my $servicename = "php55-php-fpm";
# Create specific object
my $systemd1 = new esmith::Service($servicename);
my $result1 = $systemd1->is_running();
if ( $result1 == 1 ) {
   print "Result 1 running $result1\n";
}
else {
   print "Result 1 failed $result1\n";
}
# Create non-specific object and set servicename later
my $systemd2 = new esmith::Service();
$servicename = "sshd";
$systemd2->{'serviceName'} = $servicename;
$systemd2->{'verbose'} = 1;
my $result2 = $systemd2->is_running();
if ( $result2 == 1 ) {
   print "Result 2 running $result2\n";
}
else {
   print "Result 2 failed $result2\n";
}
# So then we can do 
# (is_configured && is_enabled) do something eg restart

Uninstall

yum remove smeserver-systemd-control

Bugs

Please raise bugs under the SME-Contribs section in bugzilla

and select the smeserver-systemd-control component or use this link


Below is an overview of the current issues for this contrib:

No open bugs found.

Changelog

Only released version in smecontrib are listed here.

smeserver-systemd-control Changelog: SME 10 (smecontribs)
2022/06/07 John Crisp 0.1-2.sme
- Force update to Description with new release [SME: 11064]
2021/09/21 John Crisp 0.1-2.sme
- Updated description [SME: 11064]
2020/10/14 John Crisp 0.1-1.sme
- Initial build [SME: 11064]