{"id":2691,"date":"2023-02-02T19:05:17","date_gmt":"2023-02-02T19:05:17","guid":{"rendered":"https:\/\/hauweele.net\/~gawen\/blog\/?p=2691"},"modified":"2023-02-02T19:05:17","modified_gmt":"2023-02-02T19:05:17","slug":"override-rc-order-in-freebsd","status":"publish","type":"post","link":"https:\/\/hauweele.net\/~gawen\/blog\/?p=2691","title":{"rendered":"Override rc order in FreeBSD"},"content":{"rendered":"<p>In FreeBSD as in most other Operating Systems, the boot process consist of starting a set of scripts\/services\/daemons\/processes. Each of those has constraints like depending-on or starting before other scripts for instance.<\/p>\n<p>On a default FreeBSD install, this order would be determined by the packages you install, each of them installing a script in <code>\/usr\/local\/etc\/rc.d<\/code> that specifies its constraints requirements.<\/p>\n<p>What, however, if you wanted to change the order of the boot process? For instance, you have a script that by default starts just after the network is ready, but in your case, it specifically has to start after another script for everything to work properly.<\/p>\n<p>Well, I was confronted to that particular problem, and the answer is <i>cross-dependency-scripts<\/i> or whatever you want to call them.<br \/>\nSuppose that you have the following scripts in your boot process: A, B, C, D. By default, B, C and D start just after A. But you want to change that so B starts after D and C starts after B.<\/p>\n<p>If you changed the order dependency in script B and C directly, that change would be overwritten on the next package update. Instead we add two empty scripts __B and __C that will just enforce the dependence. That is, __B starts after D and before B, __C starts after B and before C.<\/p>\n<p>Looking at the code, at the beginning of the original scripts you would find:<\/p>\n<pre>\r\n-- rc.d\/A\r\n#!\/bin\/sh\r\n\r\n# PROVIDE: A\r\n<\/pre>\n<pre>\r\n-- rc.d\/B\r\n#!\/bin\/sh\r\n\r\n# PROVIDE: B\r\n# REQUIRE: A\r\n<\/pre>\n<pre>\r\n-- rc.d\/C\r\n#!\/bin\/sh\r\n\r\n# PROVIDE: C\r\n# REQUIRE: A\r\n<\/pre>\n<pre>\r\n-- rc.d\/D\r\n#!\/bin\/sh\r\n\r\n# PROVIDE: D\r\n# REQUIRE: A\r\n<\/pre>\n<p>Thus you would add two scripts __B and __D that contains:<\/p>\n<pre>\r\n-- rc.d\/__B\r\n#!\/bin\/sh\r\n\r\n# PROVIDE: __B\r\n# REQUIRE: D\r\n# BEFORE: B\r\n<\/pre>\n<pre>\r\n-- rc.d\/__C\r\n#!\/bin\/sh\r\n\r\n# PROVIDE: __C\r\n# REQUIRE: B\r\n# BEFORE: C\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In FreeBSD as in most other Operating Systems, the boot process consist of starting a set of scripts\/services\/daemons\/processes. Each of those has constraints like depending-on or starting before other scripts for instance. On a default FreeBSD install, this order would &hellip; <a href=\"https:\/\/hauweele.net\/~gawen\/blog\/?p=2691\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[1096,389,1129,1130],"class_list":["post-2691","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-boot","tag-freebsd","tag-order","tag-rc-d"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2691","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2691"}],"version-history":[{"count":0,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2691\/revisions"}],"wp:attachment":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}