Jump to content











Photo
- - - - -

Script that will do something when start computer


  • Please log in to reply
1 reply to this topic

#1 Mikorist

Mikorist

    ▂ ▃ █ ▅ ▆

  • Advanced user
  • 771 posts
  •  
    United Nations

Posted 13 March 2009 - 08:07 PM

If you need to put some script that will do something when
start computers where installed Debian or one of clones (Ubuntu, Mint, sidux ..), for example
add the IP address, adding routes and start ssh server:

"
ifconfig 192.168.1.1 netmask 255.255.255.0 eth0 up
route add default gw 192.168.1.1
/etc/init.d/ssh start
"

this is all stored in a file like "/home/user/script"

then the file (as root) copy to the folder:

$ cp /home/user/script/etc/init.d/

and add right after the execution:

$ chmod +X /etc/init.d/script

After this, it is necessary to do the command:

$ update-rc.d script defaults

With this we add the script to start Debian.

If we want to delete from the start, do:

$ update-rc.d -f script remove

#2 Icecube

Icecube

    Gold Member

  • Team Reboot
  • 1062 posts
  •  
    Belgium

Posted 07 April 2009 - 09:51 PM

Shouldn't it be?
$ cp /home/user/script /etc/init.d/





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users