I have created a service that autostarts my application on a read only rootFS. I was wondering if there was a to create a service file that I can enable and disable.
On the other hand, Is there a way to not start the service on the first boot.
I have not tried to do anything to get enable/disable to work since it generally requires updating symlinks. Moving them into /data may work but that feels a bit invasive.
One way to not start the service is to make it conditional on the presence or absence of a file. You can touch a stamp file somewhere in /data to determine whether to actually start or not. https://serverfault.com/questions/767415/start-systemd-service-conditionally
You could also take a look at socket units, as one of the prime use cases is on-demand service starting.
Sorry to re-open this… The main issue why I want to do this is, During the first boot my EXT4-fs resizes and that takes around 5 minutes or so. Right now my service starts after data.mount.service.
But is there somethings else that I should be doing so that It launches after the file system has expanded.
I see that there is a service dev-mmcblk0p4.device should I be waiting for this to finish or is there a other service that I should wait for before I start my service?
look at creating a systemd dependency relationship between the service that resizes your filesystem and your service so that your service only starts after that service has completed.
I believe its the mender grow service
as itself has a dependency on being before data.mount then you should already be in good shape, although in your service file “data.mount.service” should be “data.mount”