Quantcast
Channel: openSUSE Forums
Viewing all articles
Browse latest Browse all 40713

12.3 - systemd - Forcing a script to run before rsyslog start

$
0
0
Hello.
I am trying to make a script starting before rsyslog start. I install all the stuff this way :
I use sasi ( https://forums.opensuse.org/blogs/jd...rsion-1-03-52/ ) from jdmcdaniel to install my script.
For the moment, my script ( /etc/init.d/clock_generator ) do nothing but create a test variable.
I feed sasi with these to mandatory files:
Code:

#! /bin/sh
#
# Copyright (c) 2010 SuSE LINUX Products GmbH, Germany.  All rights reserved.
#
# Author: Werner Fink, 2010
#
#
# script with local commands to be executed from init before executing/root/bin/systemd_rm_clock_generator.service
# any script of a runlevel.
#
# Here you should add things, that should happen directly before entering
# a runlevel. Common environment variables for this are:
#  RUNLEVEL  -- The current system runlevel.
#  PREVLEVEL -- The previous runlevel (useful after a runlevel switch).
#
#
# Author: jcdole, 2013_06_30
#
# /etc/init.d/clock_generator
#

declare -i FOREVER=1 ON_DURATION=10 OFF_DURATION=10
#
export A_VAR_FLAG="ABCDEF"
#

And the service definition is :
Code:

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
# /lib/systemd/system/clock_generator.service
#

[Unit]
Description=/etc/init.d/clock_generator.service Compatibility
ConditionFileIsExecutable=/etc/init.d/clock_generator
Before=syslog.service

[Service]
Type=oneshot
ExecStart=/etc/init.d/clock_generator
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

So based on recommendations I get from a previous post ( https://forums.opensuse.org/english/...unmounted.html ) I add the following link to force rsyslog to start after my script:
Code:

mkdir -v  /etc/systemd/system/syslog.service.requires
ln -s  /etc/systemd/system/clock_generator.service  /etc/systemd/system/syslog.service.requires

I run into problem. The system cannot start the login service because my service clock_generator.service failed to start.
From systemd journal :
Code:

Jul 01 16:50:15 linux-hkl6.site systemd[1]: Failed to start Login Service.
Jul 01 16:50:15 linux-hkl6.site systemd[1]: Unit systemd-logind.service entered failed state
Jul 01 16:50:15 linux-hkl6.site systemd[1]: systemd-logind.service holdoff time over, scheduling restart.
Jul 01 16:50:15 linux-hkl6.site systemd[1]: Stopping Login Service...
Jul 01 16:50:15 linux-hkl6.site systemd[1]: Starting Login Service...
............
............
............
Jul 01 16:51:45 linux-hkl6.site systemd[1]: systemd-logind.service operation timed out. Terminating.
Jul 01 16:51:45 linux-hkl6.site systemd[1]: Failed to start Login Service.
Jul 01 16:51:45 linux-hkl6.site systemd[1]: Unit systemd-logind.service entered failed state
Jul 01 16:51:45 linux-hkl6.site systemd[1]: systemd-logind.service holdoff time over, scheduling restart.
Jul 01 16:51:45 linux-hkl6.site systemd[1]: Stopping Login Service...
Jul 01 16:51:46 linux-hkl6.site systemd[1]: Starting Login Service...
Jul 01 16:53:16 linux-hkl6.site systemd[1]: systemd-logind.service operation timed out. Terminating.
Jul 01 16:53:16 linux-hkl6.site systemd-journal[304]: Forwarding to syslog missed 14 messages.
Jul 01 16:53:16 linux-hkl6.site systemd[1]: Failed to start Login Service.
Jul 01 16:53:16 linux-hkl6.site systemd[1]: Unit systemd-logind.service entered failed state
Jul 01 16:53:16 linux-hkl6.site systemd[1]: systemd-logind.service holdoff time over, scheduling restart.
Jul 01 16:53:16 linux-hkl6.site systemd[1]: Stopping Login Service...
Jul 01 16:53:16 linux-hkl6.site systemd[1]: Starting Login Service...
............
............
............
Jul 01 16:53:45 linux-hkl6.site systemd[1]: Starting /etc/init.d/clock_generator.service Compatibility...
...........
Jul 01 16:53:46 linux-hkl6.site systemd[1]: clock_generator.service: main process exited, code=exited, status=127/n/a
Jul 01 16:53:46 linux-hkl6.site systemd-journal[304]: Forwarding to syslog missed 13 messages.
Jul 01 16:53:46 linux-hkl6.site systemd[1]: Failed to start /etc/init.d/clock_generator.service Compatibility.
Jul 01 16:53:46 linux-hkl6.site systemd[1]: Dependency failed for System Logging Service.
Jul 01 16:53:46 linux-hkl6.site systemd[1]: Job rsyslog.service/start failed with result 'dependency'.
Jul 01 16:53:46 linux-hkl6.site systemd[1]: Unit clock_generator.service entered failed state

But sometimes the system gets to start very late.
Here a full copy of systemd journal :
SUSE Paste

Viewing all articles
Browse latest Browse all 40713

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>