Score:0

systemctl startup with dependencies

ws flag

I am implementing a highly available memcached service. Since memcached does not persist data, when an instance starts up, I want to seed its data from a running instance. Hence the startup (in pseudo code) is....

block incoming connections to port 11211
start memcached
replicate data
unblock incoming connections

This looks straightforward, however the ExecStart script in the supplied unit file for memcached blocks while the service is running; /usr/share/memcached/scripts/systemd-memcached-wrapper /etc/memcached.conf. Therefore if I simply wrapped it in my own script, the replication & unblock would never execute.

I could split this into 2 unit files, with the second handling the replication and unblocking and requiring the first to have run, but how do I endure that the second part is always run after the first?

Should I disable the systemd memcached start and explicitly call "systemctl start memcached" from my script?

I would rather not modify the packaged systemd-memcached-wrapper script - my changes might be over-written by updates.

What would be a robust solution using systemd?

Ektich avatar
in flag
I am not familiar with the unit file supplied by memcashed, but maybe desired effect can be achieved with `ExecStartPre=` directives?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.