I have a script in a folder:
I need this script to run every time the system starts (even if no one logs in to the system). What do I need to do in order to make this happen?
You will need root privileges for any the following. To get root, open a terminal and run the command
and the command prompt will change to '#' indicating that the terminal session has root privileges.
Alternative #1. Add an initscript.
Create a new script in
(Obviously it doesn't have to be called "myscript".) In this script, do whatever you want to do. Perhaps just run the script you mentioned.
Make it executable.
Configure the init system to run this script at startup.
Alternative #2. Add commands to /etc/rc.local
with content like the following.
Alternative #3. Add an Upstart job.
with content like the following
You don't need root, or to even login.
You can edit your crontab (
This way, you can run it as a regular user.
In your home, you've a file named .bash_rc. This file is executed at the opening of your session.
Just put something like that at the end of the file :
EDIT: sorry, i didn't answer your question because my solution is executed when a user is logged in...
To execute something before the login, you can try rcconf or rc-file: http://www.debianadmin.com/manage-linux-init-or-startup-scripts.html
you can do it from GUI: