A Linux system administrator notices that a custom service is supposed to start after the local MySQL database server is up and running. However, the custom service sometimes fails because it starts too quickly and does not detect the MySQL service being ready. Which directive should the administrator add to the [Unit] section of the custom service's systemd unit file to ensure it starts after the MySQL service?
The correct answer is After=mysqld.service because the After= directive ensures that the custom service starts only after the MySQL service (mysqld.service) is active. The Wants= directive is used to start units together but does not dictate order, and BindTo= and BindsTo= are incorrect because there is no systemd directive called BindTo=, and BindsTo= creates a stronger dependency than required for start-up order – it's used to bind the start/stop of units together.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the 'After=' directive in systemd?
Open an interactive chat with Bash
How is 'Wants=' different from 'After=' in systemd unit files?
Open an interactive chat with Bash
What is the function of the 'BindsTo=' directive in systemd?