Changes

From SME Server
Jump to navigationJump to search
3,432 bytes added ,  11:53, 21 October 2021
Create Page
{{Languages}}
<!-- here we define the contrib name variable -->
<!-- we get the page title, remove suffix for translated version; if needed you can define there with the value you want-->
{{#vardefine:contribname| {{lc: {{#titleparts: {{BASEPAGENAME}} |1}} }} }}
{{#vardefine:smecontribname| smeserver-{{lc: {{#titleparts: {{BASEPAGENAME}} |1}} }} }}
<!-- we define the language -->
{{#vardefine:lang| {{lc: {{#titleparts: {{PAGENAME}} | | -1}} }} |en }}
{{Infobox contribs
|name={{#var:contribname}}
|image={{#var:contribname}}.jpg
|description_image= {{#var:contribname}} logo
|maintainer= John Crisp
|licence= GPL v2
|url= https://wiki.koozali.org
|category= Contrib,Developer
|tags=contrib'developer,perl
}}

===Maintainer===
<!-- here you need to file your username and name -->
[[User:reetp|John Crisp]]

=== Version ===
<!-- keep this first element as is, you can add some if needed -->
{{#smeversion: {{#var:smecontribname}} }}
{{#smeversion: {{#var:contribname}} }}

=== 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 ===
<tabs container>
<tab name="For SME 10">
yum --enablerepo=smecontribs install {{#var:smecontribname}}
</tab>
<tab name="For SME 9">
Not available
</tab>
</tabs>

=== Configuration ===

There are no configuration entries

This module provides the following functions:

# new
# start
# stop
# condrestart
# restart
# reload
# is_configured
# is_enabled
# is_owned
# is_running
# is_masked
# adjust
# 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 {{#var:smecontribname}}

=== Bugs ===
Please raise bugs under the SME-Contribs section in {{BugzillaFileBug|product=|component=|title= bugzilla}}
and select the {{#var:smecontribname}} component or use {{BugzillaFileBug|product=SME%20Contribs|component={{#var:smecontribname}}|title=this link}}

Below is an overview of the current issues for this contrib:{{#bugzilla:columns=id,product,version,status,summary|sort=id|order=desc|component={{#var:smecontribname}} |noresultsmessage=No open bugs found.}}

===Changelog===
Only released version in smecontrib are listed here.

{{ #smechangelog: {{#var:smecontribname}} }}


<!-- list of category you want to see this page in -->
[[Category: Contrib]]
[[Category:Howto]]
[[Category:Developer]]


<!-- Please keep there the template revision number as is -->
[[contribtemplate::2| ]]
[[contriblang:: {{#var:lang}} | ]]

Navigation menu