{"id":1529,"date":"2015-12-17T14:30:20","date_gmt":"2015-12-17T22:30:20","guid":{"rendered":"http:\/\/systemsolver.com\/StatlerBlog\/?p=1529"},"modified":"2015-12-17T14:30:20","modified_gmt":"2015-12-17T22:30:20","slug":"linux-bash-at-logon-and-at-boot","status":"publish","type":"post","link":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/2015\/12\/17\/linux-bash-at-logon-and-at-boot\/","title":{"rendered":"Linux bash at logon and at boot"},"content":{"rendered":"<p style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">I have a script that monitors for file creation and then pops up a notification<\/p>\n<p style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">I need that script to run when the user logs on, but also need to know how to run a script at boot<\/p>\n<p style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">At boot:<\/p>\n<p style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\"><a href=\"http:\/\/www.helptouser.com\/ubuntu\/607496-how-to-run-a-bash-script-after-20-sec-on-login.html\">http:\/\/www.helptouser.com\/ubuntu\/607496-how-to-run-a-bash-script-after-20-sec-on-login.html<\/a><\/p>\n<p style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<pre style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\"><code style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">crontab -e\n<\/code><\/pre>\n<pre style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\"><code style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">@reboot \/path\/to\/script\n\nand in the script put this at the top?\n<\/code><\/pre>\n<p style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\"><code style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">sleep 20<br style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\" \/> <\/code>&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">simple way of doing that is to add those lines to rc.local in your system.<\/p>\n<p style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">For that you need root or sudo rights. You can edit the file with your favourite text editor, eg <strong style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">vim<\/strong>:<\/p>\n<p style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\"><code style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">vim \/etc\/rc.local<\/code><\/p>\n<pre style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\"><code style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">(sleep 20\necho 'cpu limit bomi player at 40%'\ncpulimit -v -e bomi -l 40) &amp;\n<\/code><\/pre>\n<p style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">The first line tells the the computer to wait 20 seconds, the other 2 lines are from your script and the <code style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">&amp;<\/code> at the end tells the computer to run that in a sub shell so that your computer does not wait for the function to end and will continue with boot.<\/p>\n<p style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">You should add those lines anywhere before the <code style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">exit 0<\/code> call at the end of that script since that will make it exit and ignore any lines after that.<\/p>\n<pre style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\"><code style=\"color: black ! important;\" data-blkn-colour=\"rgba(51,51,51,1)\">\u00a0<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I have a script that monitors for file creation and then pops up a notification I need that script to run when the user logs on, but also need to know how to run a script at boot At boot: http:\/\/www.helptouser.com\/ubuntu\/607496-how-to-run-a-bash-script-after-20-sec-on-login.html &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- crontab -e @reboot \/path\/to\/script and in the script put this at the top? [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6],"tags":[],"class_list":["post-1529","post","type-post","status-publish","format-standard","hentry","category-general","category-linux"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/posts\/1529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/comments?post=1529"}],"version-history":[{"count":0,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/posts\/1529\/revisions"}],"wp:attachment":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/media?parent=1529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/categories?post=1529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/tags?post=1529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}