systemctl enable
のオプションに--now
というのを追加できた…!
いつもいつも
# systemctl enable docker # systemctl start docker
みたいに実行してて、「コマンド2回たたくの面倒だなー」か、「インストールしたときenable
忘れて、何日も経った後にrebootしたらサービスが起動してないムキー」のどっちかをよくやらかしてたんだけど、
# systemctl enable --now docker
で有効化と起動を同時に設定できました。
以下man systemctl
より。
--now
When used with enable, the units will also be started. When used with disable or mask, the units will also be stopped. The start or stop operation is only carried out
when the respective enable or disable operation has been successful.
Installing kubeadm - Kubernetes
これ見てて初めて知った。
Ansibleだとsystemdモジュールとか使えば、enabled: yes
も設定しておけば、restartやstartついでにenable設定もやってくれる。