{"id":101,"date":"2020-10-01T14:12:17","date_gmt":"2020-10-01T12:12:17","guid":{"rendered":"https:\/\/kb.smalldata.ch\/?p=101"},"modified":"2020-10-01T14:12:17","modified_gmt":"2020-10-01T12:12:17","slug":"script-einmalig-bei-erstem-boot-ausfuehren","status":"publish","type":"post","link":"https:\/\/kb.smalldata.ch\/?p=101","title":{"rendered":"script einmalig bei erstem boot ausf\u00fchren"},"content":{"rendered":"\n<p><strong>rc.local service aktivieren<\/strong><br><br><code>sudo nano \/etc\/systemd\/system\/rc-local.service<\/code><\/p>\n\n\n\n<p>inahlt halt wie folgt abf\u00fcllen:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[Unit]\n Description=\/etc\/rc.local Compatibility\n ConditionPathExists=\/etc\/rc.local\n\n[Service]\n Type=forking\n ExecStart=\/etc\/rc.local start\n TimeoutSec=0\n StandardOutput=tty\n RemainAfterExit=yes\n SysVStartPriority=99\n\n[Install]\n WantedBy=multi-user.target<\/pre>\n\n\n\n<p>inhalt aus folgender datei wird bei servicestart ausgef\u00fchrt (erste zeile #!\/bin\/bash)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/etc\/rc.local<\/pre>\n\n\n\n<p>file ausf\u00fchrbar machen<br><code>chmod +x \/etc\/rc.local<\/code><\/p>\n\n\n\n<p>service aktivieren<br><code>systemctl enable rc-local<\/code><\/p>\n\n\n\n<p><strong>script bei boot ausf\u00fchren<\/strong><\/p>\n\n\n\n<p>script erstellen welches bei start ausgef\u00fchrt wird und mit chmod +x ausf\u00fchrbar machen<br><code>nano \/usr\/local\/bin\/firstboot.sh<\/code><\/p>\n\n\n\n<p>beispielinhalt<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/bin\/bash\n#domainjoin\nsleep 30s\ncp \/etc\/sssd\/sssd.conf \/etc\/sssd\/sssd.conf.bak\nrealm leave\nsleep 15s\necho <em>password<\/em> | realm join example.com -U svc-domainjoin\nmv \/etc\/sssd\/sssd.conf.bak \/etc\/sssd\/sssd.conf\n#autostarte deaktivieren\nsed -i '\/firstboot\/d' \/etc\/rc.local\n#neustart\nreboot<\/pre>\n\n\n\n<p>in rc.local muss dan dieses script noch hinterlegt werden. mein rc.local sieht vor dem n\u00e4chsten boote so aus:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/bin\/bash\n\/usr\/local\/bin\/firstboot.sh<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rc.local service aktivieren sudo nano \/etc\/systemd\/system\/rc-local.service inahlt halt wie folgt abf\u00fcllen: [Unit] Description=\/etc\/rc.local Compatibility ConditionPathExists=\/etc\/rc.local [Service] Type=forking ExecStart=\/etc\/rc.local start TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes SysVStartPriority=99 [Install] WantedBy=multi-user.target inhalt aus folgender datei wird bei servicestart ausgef\u00fchrt (erste zeile #!\/bin\/bash) \/etc\/rc.local file ausf\u00fchrbar machenchmod +x \/etc\/rc.local service aktivierensystemctl enable rc-local script bei boot ausf\u00fchren script erstellen welches bei start &#8230; <a title=\"script einmalig bei erstem boot ausf\u00fchren\" class=\"read-more\" href=\"https:\/\/kb.smalldata.ch\/?p=101\" aria-label=\"Read more about script einmalig bei erstem boot ausf\u00fchren\">mehr lesen<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,9],"tags":[],"_links":{"self":[{"href":"https:\/\/kb.smalldata.ch\/index.php?rest_route=\/wp\/v2\/posts\/101"}],"collection":[{"href":"https:\/\/kb.smalldata.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.smalldata.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.smalldata.ch\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.smalldata.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=101"}],"version-history":[{"count":2,"href":"https:\/\/kb.smalldata.ch\/index.php?rest_route=\/wp\/v2\/posts\/101\/revisions"}],"predecessor-version":[{"id":103,"href":"https:\/\/kb.smalldata.ch\/index.php?rest_route=\/wp\/v2\/posts\/101\/revisions\/103"}],"wp:attachment":[{"href":"https:\/\/kb.smalldata.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.smalldata.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.smalldata.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}