How Setup Startup Scripts Ubuntu
Tue, Jan 8, 2013
1-minute read
For some projects I needed to run startup scripts everytime when I start my ubuntu server. Here is little how-to with addition how to run some processes using non-sudo username (normal user account).
After some searching I found out that there is a small command that allows the root to run a process as a different user.
So when I had put “sudo -u burgerboydaddy” in front of my command it worked flawlessly.
- use vim or an equivalent to write your script and make sure it starts with
|
|
- make your script executable by running command:
|
|
- copy your script to
/etc/init.d/<filename>
- run
|
|
Your script will now be ran every time your system boots, in order to remove the file from booting, first remove the script then run
|
|
If you want to run a program as a specific user
- put “sudo -u
” in front of the command in your script.