0

Ive been trying to figure out when to set my script to initiate and what to use as After= parameter.

What i need is to initiate my service as late as possible... kind of like the last service in the stack. I def. need /home to be mounted. I cant rely on wpa_supplicant nor mdns since it is not given those have been configured on the device.

Ive also read systemd docs but could not figure out what service to set to After= option in service file.

Deko
  • 1,028
  • 2
  • 15
  • 24
  • Selected answer here should get you going: http://superuser.com/questions/544399/how-do-you-make-a-systemd-service-as-the-last-service-on-boot – simurg Feb 20 '15 at 13:56
  • That actually seems just what i needed ! I will do some tests and see if that behaves like i need but other then that, man says it all! – Deko Mar 04 '15 at 23:56

1 Answers1

1

After=ABC.service means you service will launch after launching ABC.service, but it is not guarantied, so to ensure you service starts only after ABC.service use Requires=ABC.service

OR

You can use below script to achieve this. Create a file at any location of your device once home is getting mounted, and then launch your service

[Service]

Type=oneshot

ExecStart=/bin/ABC -c 'while [ ! -e /tmp/YOUR_FILE ]; do sleep 0.1 ; done'


ABC is your executable of service, it will wait till it doesn't get YOUR_FILE at /tmp/ location.

Hope this helps.

Rathin Paul
  • 419
  • 4
  • 11