Can I execute some script after daemon start?

Hi guys,

I have build a snap that lunch a daemon.
Everything woks good, but after installing and lunching my snap I would like to run some script du customize my service.
Is there a way to do this ?

The install scriplet is not what I want because it is before the start of the service.

One way out would be to package my snap installation in a script that call the install then my configurations script.

snap install mysnap*.snap

But this is not clean at all!

I’d write a shell wrapper that touches a flag file when the config scripts have run … if that flag file is missing (i.e. you are unconfigured), start your daemon backgrounded (record the PID), run the two configure scripts, touch the flag file, kill the backgrounded daemon and restart yourself …

So there is no “after install step” where I can execute some shell scripts?
The thing is that I want to run my script only at installation not a every start of the daemon.
One solution could be calling configure scripts directly from the service when it’s all started and not configured …

well, if you have that flag file check your script will only start the daemon on all subsequent runs …

(and no, i dont think there is any hook beyond the normal configure hooks you could use at snap install time … but these would always run before anything is started)

Note that the configure hook runs after services are started, during installation. Is that what you’re looking for?

Thanks I will take a look at this. Meanwhile I run my scripts configs inside my service