Startup script as root

New to Debian (Or Linux in general)? Ask your questions here!

Startup script as root

Postby nord666 » 2010-09-05 23:41

Hello all,

I need to run a few simple commands at the startup of my computer. (need to run as root if possible without needing to enter login's infos)

Basicly, the commands are about the same line, so i'll just post one:
Code: Select all
screen -S Name1 -L -d -m php -f /root/mainloop.php config.php


Thanks,
nord666
 
Posts: 2
Joined: 2010-09-05 23:30

Re: Startup script as root

Postby dbbolton » 2010-09-05 23:50

nord666 wrote:Hello all,

I need to run a few simple commands at the startup of my computer. (need to run as root if possible without needing to enter login's infos)

Basicly, the commands are about the same line, so i'll just post one:
Code: Select all
screen -S Name1 -L -d -m php -f /root/mainloop.php config.php


Thanks,

Make an init script: http://www.debian-administration.org/articles/28
You can make a single shell script containing all the commands you need to run, and then call that shell script from the init script.

Why do you need these commands to be executed before root logs in?
GitHub | zsh docs in Letter PDF

Telemachus wrote:Put down the CGI.
User avatar
dbbolton
 
Posts: 2133
Joined: 2007-06-20 08:17
Location: Iapetus

Re: Startup script as root

Postby nord666 » 2010-09-05 23:53

Thank you for fast answer :D!
I'll try this right now.


This is a personal server without monitor/keyboard/mouse. So starting my laptop to run these three command (over ssh) everytimes it get shutdown can be annoying. (eg: thunderstorm) So, just pressing the power button in from of it could be nice.

edit: finaly a tutorial that it is understandable. Thx again
nord666
 
Posts: 2
Joined: 2010-09-05 23:30

Re: Startup script as root

Postby smallchange » 2010-09-06 00:32

Or just put your command in /etc/rc.local. That script gets run after all other init scripts and is intended just for this purpose.
smallchange
 
Posts: 1740
Joined: 2009-05-04 15:56


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable