Skip to content

Start the service before microshift starts #4923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
neetabisht opened this issue May 19, 2025 · 1 comment
Open

Start the service before microshift starts #4923

neetabisht opened this issue May 19, 2025 · 1 comment

Comments

@neetabisht
Copy link

Hi Team,

I need to ensure that a fetch_hostname system service starts before the MicroShift service.
I took a reference of microshift-ovs-init.service and accordingly created fetch_hostname.service as below:

[Unit]
Description=Fetch hostname
Before=microshift.service

[Service]
Type=oneshot
ExecStart=/bin/bash /usr/bin/fetch_hostname.sh

I've tried several combinations, such as starting the fetch_hostname.service after the crio and network services, but nothing seems to be working. The fetch_hostname.service is not at all starting before the microshift service.
Is there any other way to start any service before microshift service starts.

@pacevedom
Copy link
Contributor

Hi,

Just using the Before= wont be enough, as there is no hard dependency between the services, MicroShift is not aware of fetch_hostname.
You will need to use a drop in configuration for MicroShift to add Requires= and After=. Something like:

[Unit]
Requires=fetch_hostname.service
After=fetch_hostname.service

Then store this in /etc/systemd/system/microshift.service.d/hostname.conf, run systemctl daemon-reload and relaunch MicroShift with systemctl start microshift.service.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants