Page 1 of 1

Solved: run script on startup

Posted: Sat Jan 16, 2010 6:05 pm
by mister_v
Hi,

Ho do I run a script when my linux PC starts up.

I want to run a script that check some url's when my pc boots.
But it has to be done after the network is setup.

Thanks

Re: run script on startup

Posted: Sat Jan 16, 2010 7:35 pm
by Chris
On my gentoo box I use

Code: Select all

/etc/conf.d/local.start
Local should run on start up by default and executes as the last thing.

Just add a line with the command to execute,
or the path to the script to execute.

Re: run script on startup

Posted: Sun Jan 17, 2010 3:55 pm
by mister_v
Thanks,

But i don't have the file:

Code: Select all

/etc/conf.d/local.start
I use Kubuntu 9.10.

Is there another method?

I thought of creating a service in

Code: Select all

/etc/init.d

Re: run script on startup

Posted: Mon Jan 18, 2010 6:39 pm
by Chris
To start a script at boot in ubuntu,
you can add a line in

Code: Select all

/etc/rc.local
You can also create a service, but that perhaps overkill.

The quick and dirty way to create a service:
  • 1- create a file under init.d :

    Code: Select all

    sudo nano /etc/init.d/new_script
    2- put your command lines/script in the file & save it
    3- make the file executable :

    Code: Select all

    sudo chmod +x /etc/init.d/new_script
    4- make it run on boot :

    Code: Select all

    sudo update-rc.d new_script defaults

Re: run script on startup

Posted: Tue Jan 19, 2010 10:46 pm
by mister_v
Thanks,

Code: Select all

/etc/rc.local
works great.