1

I am working with the service files in Centos 7 and am creating one for xymon. The issue I am running into is I am trying to configure start, stop, and restart. I went as far as using an existing service file as a template, but no matter which option I pick the "stop" option is used without fail.

# more xymon.service
[Unit]
Description=Xymon Monitor Service
After=network.target
[Service]
Type=simple
#User=xymon
ExecStart=/home/xymon/startup/xymon-init.d start
ExecReload=/home/xymon/startup/xymon-init.d restart
ExecStop=/home/xymon/startup/xymon-init.d stop
[Install]
WantedBy=multi-user.target

I tried simple, forked, and a couple other variants to no avail. I put a dummy script in which printed the first parameter and I always get stop in the log file. I have done other types of service files without issue in the past, but this is my first foray into this systemctl. Any help would be appreciated.

0

Usually systemd can convert init.d scripts into services without you having to generate a .service unit file - if the scripts are in the init.d directory, are executable and can be parsed succesfully by systemd, then (without a .service file) running systemctl status xymon should just work. That, obviously, isn't always the case. The only service that I have like that on my centos 7 machine is VMWare workstation - in that case it just works without a service file.

Here is the recommended service file to start xymon using systemd and no init.d scripts. You will likely have to move them out of the init.d area once this is working (and definitely prior to reboot). Presumably they aren't working in their current state, but they could still be doing enough to interfere.

There are rpms (and srpms) available for el7 from this site: http://terabithia.org/rpms/xymon/ They are apparently somewhat beta versions of it, but they contain the systemd configuration, which are not in the official sourceforge downloads.

# xymonlaunch.service
# systemd file for Fedora 18 and up, or RHEL 7 and up

[Unit]
Description=Xymon systems and network monitor
Documentation=man:xymon(7) man:xymonlaunch(8) man:xymon(1)
After=network.target

[Install]
# Compatibility with "xymon" and "xymon-client"
Alias=xymon.service
Alias=xymon-client.service
WantedBy=multi-user.target


[Service]
EnvironmentFile=/etc/sysconfig/xymonlaunch
User=xymon
# We wrap in xymoncmd to eliminate the need for the bulk of the old init script
ExecStart=/usr/bin/xymoncmd /usr/sbin/xymonlaunch --no-daemon $XYMONLAUNCHOPTS
Type=simple

# Kill xymonlaunch, but don't send kills to the underlying procs, since they
# might be doing important things (like writing checkpoints and flushing caches)
KillMode=process
# SendSIGHUP=yes
SendSIGKILL=no
  • A couple minor tweaks but basically this version works starting and stopping. To help others who have a basic install here is my version: – John Langbein May 25 '16 at 14:06
  • XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX – John Langbein May 25 '16 at 14:13
1

NOTE- The answer from Argonauts worked with some mods. Here is the working version in my environment based on a standard install:

# xymonlaunch.service
# systemd file for Fedora 18 and up, or RHEL 7 and up

[Unit]
Description=Xymon systems and network monitor
Documentation=man:xymon(7) man:xymonlaunch(8) man:xymon(1)
After=network.target

[Install]
# Compatibility with "xymon" and "xymon-client"
Alias=xymon.service
Alias=xymon-client.service
WantedBy=multi-user.target


[Service]
#EnvironmentFile=/etc/sysconfig/xymonlaunch
User=xymon
# We wrap in xymoncmd to eliminate the need for the bulk of the old init script
ExecStart=/home/xymon/server/bin/xymoncmd /home/xymon/server/bin/xymonlaunch --no-daemon $XYMONLAUNCHOPTS
Type=simple

# Kill xymonlaunch, but don't send kills to the underlying procs, since they
# might be doing important things (like writing checkpoints and flushing caches)
KillMode=process
# SendSIGHUP=yes
SendSIGKILL=no

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.