{"id":683,"date":"2014-01-24T04:36:31","date_gmt":"2014-01-24T11:36:31","guid":{"rendered":"http:\/\/somethingk.com\/main\/?p=683"},"modified":"2014-01-26T19:30:11","modified_gmt":"2014-01-27T02:30:11","slug":"linux-running-scripts-on-startup","status":"publish","type":"post","link":"https:\/\/somethingk.com\/main\/linux-running-scripts-on-startup\/","title":{"rendered":"Linux: Running Scripts on Startup"},"content":{"rendered":"<p>One of the easiest ways to run a script or command on startup is to use the crontab.<\/p>\n<p>The crontab includes an entry string to let you run a script after reboot or on startup.<\/p>\n<p>Enter the crontab.<\/p>\n<pre>crontab -e<\/pre>\n<p>Add an item to run on startup.<\/p>\n<pre>@reboot &lt;COMMAND OR SCRIPT TO RUN&gt;<\/pre>\n<p>My crontab entry is visible below. I used this to start all my scripts on my <a title=\"Soldering an LCD to the Raspberry Pi\" href=\"http:\/\/somethingk.com\/main\/?p=666\">Pi creation<\/a>.<\/p>\n<p><a href=\"http:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/01\/Screen-Shot-2014-01-26-at-12.30.43-PM.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-medium wp-image-702\" alt=\"Screen Shot 2014-01-26 at 12.30.43 PM\" src=\"http:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/01\/Screen-Shot-2014-01-26-at-12.30.43-PM-300x190.png\" width=\"300\" height=\"190\" srcset=\"https:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/01\/Screen-Shot-2014-01-26-at-12.30.43-PM-300x190.png 300w, https:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/01\/Screen-Shot-2014-01-26-at-12.30.43-PM.png 568w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Other startup options include, writing an entry into the <a title=\"Aliases,  loosing command identity\u2026\" href=\"http:\/\/somethingk.com\/main\/?p=554\">bashrc<\/a>. For the Pi, you could also write an entry in \/etc\/rc.local. This <a title=\"How to execute a shell script on startup?\" href=\"http:\/\/superuser.com\/questions\/126106\/how-to-execute-a-shell-script-on-startup\" target=\"_blank\">article<\/a> discusses actually creating an <a title=\"Init.d Scripts\" href=\"http:\/\/somethingk.com\/main\/?p=705\">init.d<\/a> script for those interested.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the easiest ways to run a script or command on startup is to use the crontab. The crontab includes an entry string to let you run a script after reboot or on startup. Enter the crontab. crontab -e Add an item to run on startup. @reboot &lt;COMMAND OR SCRIPT TO RUN&gt; My crontab entry is visible below. I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[166,165,164,5],"class_list":["post-683","post","type-post","status-publish","format-standard","hentry","category-linux","tag-crontab","tag-scripts","tag-startup","tag-terminal"],"_links":{"self":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/comments?post=683"}],"version-history":[{"count":11,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/683\/revisions"}],"predecessor-version":[{"id":717,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/683\/revisions\/717"}],"wp:attachment":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/media?parent=683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/categories?post=683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/tags?post=683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}