{"id":1391,"date":"2021-06-04T13:16:01","date_gmt":"2021-06-04T12:16:01","guid":{"rendered":"https:\/\/matthewolden.co.uk\/?p=1391"},"modified":"2025-06-18T09:30:09","modified_gmt":"2025-06-18T08:30:09","slug":"auto-start-a-program-on-boot","status":"publish","type":"post","link":"https:\/\/matthewolden.co.uk\/?p=1391","title":{"rendered":"auto-start a program on boot"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>!!!!!!!!!!!!!*******************************!!!!!!!!!!!!!<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">NEW TECHNIQUE FOR NEWER VERSIONS OF OS<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>!!!!!!!!!!!!!*******************************!!!!!!!!!!!!!<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">for new versions of the os follow these instructions .Autostart works different on the newer releases.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">this is for  Bookworm on a RPi5.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open the File Manager and select View -&gt; Show Hidden.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You should see a .config folder. Change to that folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Right click on the list of files and select &#8220;New Folder&#8221;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Enter &#8220;autostart&#8221; as the name.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now you should have a &#8220;.\/.config\/autostart&#8221; folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create a file named &#8220;test.desktop&#8221; in the &#8220;.\/.config\/autostart&#8221; folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In it type&#8230;&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Type=Application<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Name=Chromium<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Exec=chromium<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Terminal=false           &#8220;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Set the file permissions on test.desktop file as &#8220;executable by anyone&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Reboot.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Edit: You can move or copy a desktop file from your \/Desktop folder,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If it runs there when you double click it, it will autostart in the &#8220;.\/.config\/autostart&#8221; folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>BELOW IS THE OLD WAY<\/strong><\/p>\n\n\n<p class=\"p2\"><span class=\"s1\">open a\u00a0text document.<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">save it , onto the desktop as<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">startup.sh<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1394\" src=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitled-31-1024x851.jpg\" alt=\"Untitled 3\" width=\"660\" height=\"548\" \/>then open terminal and type in (really important this)<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">sudo chmod 755 \/home\/pi\/Desktop\/startup.sh<\/span><\/p>\n<p class=\"p3\"><span class=\"s1\">sudo nano \/etc\/xdg\/lxsession\/LXDE-pi\/autostart<\/span><\/p>\n<p class=\"p3\">then right at the bottom add<\/p>\n<p class=\"p3\">@\/home\/pi\/Desktop\/startup.sh<\/p>\n<p class=\"p3\">then exit and save (ctlt x , y , return)<\/p>\n<p class=\"p3\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1395\" src=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitled-41-1024x684.jpg\" alt=\"Untitled 4\" width=\"660\" height=\"440\" \/><\/p>\n<p class=\"p3\">this will now open this file every time the computers boots up.<\/p>\n<p class=\"p3\">to get it to do something open startup.sh in text editor and type<\/p>\n<p>sleep 2<\/p>\n<p>pd \/home\/pi\/Desktop\/pdtest.pd<\/p>\n<p>then save it<\/p>\n<p><a href=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitled-2kk.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1398\" src=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitled-4j-887x1024.jpg\" alt=\"Untitled 4j\" width=\"660\" height=\"761\" \/><\/a><\/p>\n<p>now if we test this by opening this file by double clicking then choosing Execute<\/p>\n<p>it waits for 2 seconds, then opens Pd with the patch pdtest.pd, which is found at\u00a0\/home\/pi\/Desktop\/pdtest.pd<\/p>\n<p><a href=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitled-2kk.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1397\" src=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitled-3kk-1024x622.jpg\" alt=\"Untitled 3kk\" width=\"660\" height=\"400\" \/><\/a><\/p>\n<p><a href=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitled-2kk.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1396\" src=\"https:\/\/matthewolden.co.uk\/wp-content\/uploads\/2021\/09\/Untitled-2kk-1024x648.jpg\" alt=\"Untitled 2kk\" width=\"660\" height=\"417\" \/><\/a><\/p>\n<p>if we don&#8217;t want this to happen every time the pi boots up, rename the startip.sh file to something else, this file can also be modified to open any application or process .<\/p>","protected":false},"excerpt":{"rendered":"<p>!!!!!!!!!!!!!*******************************!!!!!!!!!!!!! NEW TECHNIQUE FOR NEWER VERSIONS OF OS !!!!!!!!!!!!!*******************************!!!!!!!!!!!!! for new versions of the os follow these instructions .Autostart works different on the newer releases. this is for Bookworm on a RPi5. Open the File Manager and select View -&gt; Show Hidden. You should see a .config folder. Change to &#8230;<\/p>\n","protected":false},"author":2,"featured_media":1392,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1391","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pd-on-a-pi","column","fourcol","has-thumbnail"],"_links":{"self":[{"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1391"}],"version-history":[{"count":2,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1391\/revisions"}],"predecessor-version":[{"id":2861,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1391\/revisions\/2861"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=\/wp\/v2\/media\/1392"}],"wp:attachment":[{"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matthewolden.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}