Linux bash at logon and at boot

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

——————-

crontab -e
@reboot /path/to/script

and in the script put this at the top?

sleep 20
—————

simple way of doing that is to add those lines to rc.local in your system.

For that you need root or sudo rights. You can edit the file with your favourite text editor, eg vim:

vim /etc/rc.local

(sleep 20
echo 'cpu limit bomi player at 40%'
cpulimit -v -e bomi -l 40) &

The first line tells the the computer to wait 20 seconds, the other 2 lines are from your script and the & 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.

You should add those lines anywhere before the exit 0 call at the end of that script since that will make it exit and ignore any lines after that.

 

Comments are closed.