Progress on this migration: (not yet commited until all is working (tested at
least on rhel6,fedora17,ubuntu1204)
SystemServices.pm is rewritten, and I'm now in the process of fixing all
scripts that relies on /etc/init.d to start/top/restart/get status of daemon
(fails on fedora-15+ and more).
now, the correct code to get status of a daemon (enabled, disabled, ...) and
start,stop, restart it will be done this way: (example: opkg-networking-server
: server-post-install)
use strict;
use OSCAR::OCA::OS_Settings;
use OSCAR::SystemServices;
use Carp;
# dns_service is defined in
/usr/share/perl5/vendor_perl/OSCAR/OCA/OS_Settings/{default,compatdistro,compatdistrover,distro,distrover,ident)
# (on FC-17: default, rhel,rhel6,fedora,fedora17,fedora-17-0)
my $named = OSCAR::OCA::OS_Settings::getitem("dns_service");
# If undefined, we assume that the $service is named "named".
$named = "named" if (not defined $named);
# Enabling DNS service
OSCAR::SystemServices::enable_system_services( ($named) );
# Restarting DNS service (avoid restart as it fails if not started on some
configuration).
OSCAR::SystemServices::system_service(OSCAR::SystemServicesDefs::STOP(),$named);
OSCAR::SystemServices::system_service(OSCAR::SystemServicesDefs::START(),$named);
Still need to migrate those files.
./ganglia/scripts/api-post-deploy
./ganglia/scripts/edit_ganglia_conf
./ganglia/scripts/server-post-install
./loghost/scripts/api-post-deploy
./maui/scripts/api-post-image
./maui/testing/test_root
./mta-config/scripts/api-post-deploy
./mta-config/scripts/enable.client.mail-locally
./mta-config/scripts/server-post-install
./netbootmgr/scripts/multi-arch-prepare
./netbootmgr/scripts/server-post-install
./nfs/scripts/server-post-install
./ntpconfig/doc/install.tex
./ntpconfig/scripts/api-post-deploy
./ntpconfig/scripts/client-post-install
./ntpconfig/scripts/server-post-install
./oda/scripts/api-post-deploy
./oda/scripts/api-post-install
./pfilter/scripts/api-post-clientdef
./sge/scripts/server-post-install
./sis/config.xml
./sis/scripts/api-post-image
./sis/scripts/si_monitor.patch
./slurm/scripts/api-post-deploy
./slurm/scripts/server-post-install
./slurm/testing/test_root
./torque/scripts/api-post-deploy
./torque/scripts/server-post-install
./torque/testing/test_root
--
Olivier LAHAYE
CEA DRT/LIST/DM2I/DIR
________________________________
De : LAHAYE Olivier
Date d'envoi : mercredi 9 octobre 2013 17:06
À : oscar-devel@lists.sourceforge.net
Objet : [PROVENANCE INTERNET] [Oscar-devel] linux system services management
cleanup and codeuniformisation.
In order to be able to handle newer distros (fedora17+, ...) that uses
exclusively systemd, I need to fix how system services are handeled (start,
stop, restart, enable, disable, ...) (example: on fedora17+, /etc/init.d/gmond
doesn't exists. (it's /lib/systemd/system/gmond.service that is used)).
Instead of doing if else statement each time a service needs to be started or
enabled, I've seen that the base stuffs are already in place
(SystemService.pm). Unfortunately, it's not quite ready to support systemd, so
I need to fix things on the following components:
1/ OSCAR::OCA::OS_Detect (Added a service_mgt field: containing either systemd,
initscripts, manual).
Set it in the distro specific pm file. typically, debian is manual (start
scripts by calling /etc/init.d/service. redhat is initscripts (use the service
command), fedora15+ is "systemd" (systemctl used to enable, disable, start, ...)
2/ OSCAR::OCA::OS_Settings: will remove absolute path for the init script. will
keep only the name. Then we will read the os specific http_daemon and start it
using SystemService::
We should be able to avoid this in the future: (from ganglia opkg:
edit_ganglia_conf)
> # autoload apache in levels 345 and start it up
> my $HTTPD;
> for my $srv ("httpd", "apache2", "apache") {
> if (-x "/etc/init.d/$srv") {
> $HTTPD=$srv;
> last;
> }
> }
SystemServices.pm: Instead of gessing the right command to use based on sitro
packaging system, we use the os->{service_mgt} from OS_Detect::open. the we
clean up SystemServices.pm and now starting or restarting a service will be
usable.
Then use this code instead of checking -x /etc/init.d/daemon or blindly use
chkconfig wich fails on ubuntu as it's not mandatory for the system to have
/sbin/chkconfig installed.
Hopefully, it should be ok in a few days provided I don't find any code
elsewhere that can't be updated
Olivier.
--
Olivier LAHAYE
CEA DRT/LIST/DM2I/DIR
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Oscar-devel mailing list
Oscar-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oscar-devel