Hello,
Is there a way to daemonize chef-client even if I don't have the server open? (Still running though of course) Or do I have to explicitly open the command line and keep it open until I don't want to run as daemon anymore?
Hello,
Is there a way to daemonize chef-client even if I don't have the server open? (Still running though of course) Or do I have to explicitly open the command line and keep it open until I don't want to run as daemon anymore?
If you want it to run just one time as a background job then you can create a cron and run it on demand. If you want to run periodically then set the schedule on the cron and it will even if you are not logged on. Is that what you are looking for ?
Yes thats perfect, thank you. One thing though, would I be creating the cron as a recipe using the chef resource or would that be an outside thing id have to install?
You can do it either ways. If you have a bootstrapping cookbook that runs when VM starts up for the first time then you can put a cron resource within a recipe of that cookbook and it will auto create the cron job with your chef-client ... as the command. Then for example if there multiple reboots during bootstrap you want chef client to be running automatically on each reboot then just configure the cron to start when system boots up. It will run chef client command automatically on each system boot up. One thing to ensure there is all your resources in cookbooks are idempotent otherwise same config will be applied on each run over and over.
Use the chef-client cookbook and simply using attributes you can switch it up from systemv service to cron or on demand. Very configurable.
Simply search the supermarket.chef.io for the cookbook. Also love the chef updater cookbook to pin the environment.