You are not logged in.

#1 2008-02-18 04:55:16

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

How To Start A Script When You Start The Computer

I would like to run a script when I start my computer. It needs to run as root and go something like this...

/etc/rc.d/moblock start
/etc/rc.d/moblock stop
/etc/rc.d/moblock start

The reason I need to do it like this is because moblock currently has a bug in which it will not work the first time it is loaded after powering on the system.

Offline

#2 2008-02-18 04:57:19

peart
Member
From: Kanuckistan
Registered: 2003-07-28
Posts: 510

Re: How To Start A Script When You Start The Computer

Put the commands in /etc/rc.local.  They will get executed at boot time, after all the other services are started.

Last edited by peart (2008-02-18 04:57:36)

Offline

#3 2008-02-18 05:01:19

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: How To Start A Script When You Start The Computer

You'll probably also need to add something like "sleep 10" after the first "/etc/rc.d/moblock start" because it takes a while before moblock actually fails on the first run.  Best thing to do, I think, would be to put all of this in a separate script and then execute that script from rc.local with a & after it (so that it runs in the background).

Offline

Board footer

Powered by FluxBB