I have a single line script I need to have run as root.
Where's the best file to put it in?
Ta.
topic title: User script to run as root at startup
6 posts
• Page 1 of 1
-
Posts: 112
- Joined: 18 Apr 2009
- Posts: 1,081 OU812
- Joined: 29 Sep 2007
#2
We put our scripts - antixcc, logout, screenshot, etc., in /usr/local/bin.
john
john
-
anticapitalista
Posts: 5,955
- Site Admin
- Joined: 11 Sep 2007
#3
For a script to run at startup (ie before X starts), try /etc/rc.local
If not, you would have to run it in /etc/init.d
If not, you would have to run it in /etc/init.d
-
Posts: 1,139
- Joined: 26 Apr 2008
#4
To pull John's and Anti's comments together, put your script in /usr/local/bin and invoke it by calling it in /etc/rc.local. Hope that was obvious, but just in case, I thought it might be worth mentioning. Have fun with it, and let us know how it works out!
-
Posts: 112
- Joined: 18 Apr 2009
#5
Thanks Brian, I've just added it to /etc/rc.local as it's only a single command to get my wifi driver up to speed. Remembered this is how I did it on previous debian based distros.
-
Posts: 1,139
- Joined: 26 Apr 2008
#6
Have fun with it!
That's cool, and that's fine. Some commands, particularly those done with the rc.local file, can be handled in that manner. If you were putting it in /etc/rc5.d, in that case, it would make more sense to create a script that follows the typical start up conventions with start, stop, and restart, plus the S to start, K to kill, and a number indicating the relative sequencing of the startup and shutdown commands. In this case, however, this is something far simpler, it is implemented only in the local file, which is not affected by version changes, so you can do pretty much whatever you want there. Glad the Debian memories returned, since this is an excellent Debian based distribution!chrishall57 wrote:Thanks Brian, I've just added it to /etc/rc.local as it's only a single command to get my wifi driver up to speed. Remembered this is how I did it on previous debian based distros.
Have fun with it!