I have been doing a lot of research but haven't found anything that really answers my question.
I wrote a bash script that automatically changes the nice values on certain processes. This script needs to run on startup (I currently have it in startup application) and needs suid
permissions to actually change the nice values. I've tried a few things with chmod and changing ownership of the file over to root but nothing seems to be working. I keep getting a "permission denied" when the script runs.
It runs fine when i manually start it in terminal using: sudo ./myfile
but does not work when started on bootup
I am using Ubuntu
At first copy your script in /etc/init.d
then(for redhat based servers like centos)
chmod +x script.sh
chkconfig --add script.sh
chkconfig --level 0123456 script.sh on
For Debian based like ubuntu: help help2 help3
try:
cp /path/to/your/script.sh /etc/init.d/
chmod +x /etc/init.d/yourscript.sh
update-rc.d yourscript defaults
Runlevels are logical groups of tasks. Traditionally you have five run levels.
0 boot
1 single user
2 not used
3 multiuser
4 not used
5 gui
6 reboot