Solved: run script on startup

Locked
mister_v
Posts: 139
Joined: Sat Jun 20, 2009 5:42 pm

Solved: run script on startup

Post 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
Last edited by mister_v on Tue Jan 19, 2010 10:46 pm, edited 1 time in total.
Chris
Site Admin
Posts: 129
Joined: Mon Jul 21, 2008 9:45 am
Location: Leuven, Belgium
Contact:

Re: run script on startup

Post 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.
mister_v
Posts: 139
Joined: Sat Jun 20, 2009 5:42 pm

Re: run script on startup

Post 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
Chris
Site Admin
Posts: 129
Joined: Mon Jul 21, 2008 9:45 am
Location: Leuven, Belgium
Contact:

Re: run script on startup

Post 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
mister_v
Posts: 139
Joined: Sat Jun 20, 2009 5:42 pm

Re: run script on startup

Post by mister_v »

Thanks,

Code: Select all

/etc/rc.local
works great.
Locked