jump to navigation

Adding a startup script to be run at bootup September 7, 2005

Posted by Carthik in ubuntu.
trackback

So you have a script of your own that you want to run at bootup, each time you boot up. This will tell you how to do that.

Write a script. put it in the /etc/init.d/ directory.
Lets say you called it FOO. You then run

% update-rc.d FOO defaults

You also have to make the file you created, FOO, executable, using
$chmod +x FOO

You can check out
% man update-rc.d for more information. It is a Debian utility to install scripts. The option “defaults” puts a link to start FOO in run levels 2, 3, 4 and 5. (and puts a link to stop FOO into 0, 1 and 6.)

Also, to know which runlevel you are in, use the runlevel command.

Comments»

1. mikey - September 26, 2005

Couldn’t you just stick “/bin/sh /path/to/script.sh” into /etc/rc.d/rc.local ?

2. ubuntonista - September 26, 2005

I was just putting the recommended debian/ubuntu way of doing it. I am sure there are other ways to do it too :)

3. bbpackwood - October 15, 2005

Hmm…I’m not sure if this works for me. It would appreat the script is executed when I shut down, not when I log in.

Also another question: the script I want to roon requires root access. Do I need to do anything sepcial?

Thx.

4. ubuntonista - October 16, 2005

bbpackwood, I am not sure how one would add scripts to be run at shutdown. I will look into it, though.

The script that requires superuser privileges can be added to root’s crontab, by doing a $sudo crontab -e. That is the easiest way I can think of.

5. bbpackwood - October 16, 2005

After some playing around, I found the best way to run my startup script was to add it at the end of:

/etc/init.d/rcS.sh

The other menthods mentioned did not work for me.

I have a Dell Inspiron 700m that need a 1280 x 800 screen resolution. I was able to get it to work with a great tool called 855resolution that need to be executed at startup.

6. Nabil - October 22, 2005

Thanks bbpackwood,

I have the same computer and the same problem. I’ll give your method a try.

7. Kernel Source » Configurando el arranque nde nuestra máquina - February 10, 2006

[...] Vía: Ubuntu Blog PDF [...]

8. samyboy - February 13, 2006

You can use update-rc.d for start-only or stop-only scripts

Start my script on startup :
# update-rc.d -f my_script start 99 2 3 4 5 .

where
- start is the argument given to the script (start, stop).
- 99 is the start order of the script (1 = first one, 99= last one)
- 2 3 4 5 are the runlevels to start

Dont forget the dot at the end
More info in /etc/rcS.d/README

Start my_script on shutdown and reboot :
# update-rc.d -f my_script start 90 0 6 .

Stop my_script on halt and reboot :
# update-rc.d -f my_script reboot 90 0 6 .

If you want to make your own demon, you can use the skeleton file provided at
/etc/init.d/skeleton

about runlevels :

To know which runlevel you are running, simply type
$ runlevel

more info about runlevels here : http://oldfield.wattle.id.au/luv/boot.html#init

happy scripting

9. Mezzanine » Startup Script at Bootup - February 16, 2006
10. Louis - February 17, 2006

Nothing worked, since what I need to do required super user to be active. Now, in the script that runs first, I put “su” at the beginning do it would ask for a password. I type it in, then nothing happens. Just goes to a prompt. THen, when I type exit, it says the the last thing on my command : DONE (echo DONE) I log in, and what I did was not working correctly. SO, I just took su out, then tried it, nothing happened. Tried cron jobs, it would not work, gave me some wierd error. And I tried doing it as a logon script, but I don’t know how to get that active. I have it in the folder required, but nothing happens.
My script:

iwconfig wlan0 essid RUAbel2cME
echo ESSID done.
iwconfig wlan0 key
echo KEY done
echo Starting dhclient….
dhclient
echo DONE

Help?
Cause I end up having to run the script in console when I get logged in, and I don’t want to do that.

asmith - February 24, 2011

All scripts stored in /etc/init.d are runned by ROOT user. Make sure you set the execution bit for root you can do chmod +x /etc/init.d/your_script and then run update-rc.d

11. Paloseco - March 1, 2006

The rc-update used in gentoo is much more intuitive.

12. Sh33zo - March 10, 2006

how do i remove this new script? I want to change its name!
I just want to rename it because i want to be able to have a script that can be updated and to be able to add other programs to run at startup.

13. Arcanus Maximus - March 29, 2006

rc.local in Ubuntu

I am running Breezy Ubuntu and I don’t have an rc.local on the system. I don’t know if this is a concious decision or an oversite. Here are the steps I used to create one. 1. create /etc/init.d/rc.local #!/bin/sh #rc.local…

14. Benjamin - June 14, 2006

update-rc.d -f my_script start 99 2 3 4 5 . – That worked perfectly

15. Jay Holler - July 13, 2006

OK, maybe I’m not seeing the problem, but this isn’t working for me. I have a tiny little script called mousekeys.sh

here it is:

#!/bin/sh

xmodmap -e ‘keycode 116 = Pointer_Button2′
xmodmap -e ‘keycode 108 = Pointer_Button3′
xkbset m

So, when I run this from terminal it works flawlessly: ./mousekeys.sh

But upon following the instructions above, both methods fail for me.

I’ve tried:
update-rc.d FOO defaults
update-rc.d -f my_script start 99 2 3 4 5 .

the second one tells me that the link already exists, which is a good sign. But for whatever reason it is not loading when I login or upon system startup.

Any ideas why this isn’t working?

16. Jay Holler - July 13, 2006

I tried editing the first line by using

#!/bin/bash

instead, but to no avail. I’m stumped.

17. Matt - July 26, 2006

bump

Anyone try this guy’s site: http://rob.pectol.com/content/view/17/33/

(can’t figure out how to add multiple commands yet)

18. Raghu Nayak - August 1, 2006

Hi…

Can I start a daemon program which requires super user privilege with this ? If yes how, If no, How can I do that ?

Please Help..

19. scotte - September 26, 2006

Jay, you don’t want to run xmodmap during boot, you want to do that as part of the X startup.

Raghu, programs started at boot already run as root.

20. Scott - September 28, 2006

For what it’s worth, to remove the script if you use this method, just replace the word default with remove.

So it’s % update-rc.d FOO remove

21. su man page - November 14, 2006

su -c if you need to run a command as joe schmoe.

22. Metonymie :: Digitalis Cyganis » Archivo » Configurar el Modem amigo en Ubuntu.. (ADSL Telecom) - November 20, 2006

[...] Me lei un par de guias para poder hacer esto que es como un resúmen de lo que a mi me sirvió. Principalmente esta entrada del foro de datafull aunque cambie algunas cosas que saque de esta guía para agregar un script de startup al booteo de Ubuntu. [...]

23. Tony - December 20, 2006

ok to make things simple…

I have a program that uses the standard C/C++ libs. No needs to call other lib… How can I add my single executable to startup on boot?

noratech04@yahoo.com

24. Jon Jay Obermark - February 21, 2007

To the guy who needs to run as root. Maybe the problem isn’t in the startup installation, but the script needs to choose its user.

Have you tried the syntax:
sudo -u

inside the script?

25. suma sharma - March 1, 2007

when i enter the command:
update-rc.d name defaults

i get the following error:
bash: update-rc.d: command not found

26. GobiHawk - March 1, 2007

sudo -u inside the script. How to you eliminate being ask for a password?

27. Puneet - March 26, 2007

Thanks :)

28. providencemac - March 27, 2007

@louis

I had the exact same problem until I saw the tutorial here: http://www.youtube.com/watch?v=d39izaupvEg

The problem is described at the end of the video: you must specify the full path of the commands you are calling. Therefore, change your script to:

/sbin/iwconfig wlan0 essid RUAbel2cME
/sbin/iwconfig wlan0 key
/sbin/dhclient

29. stooka - May 3, 2007

it works! thank you. I was having issues with my wireless card in an acer (bcm4318). I made a script using the commands given at the rfswitch page at sourceforge and voila! Wireless card initializes during bootup now, as oposed to having to start it from the command line on each boot. I’m a total noob but this makes me so happy

30. purposed - July 12, 2007

Ubuntu Feisty (at least on my ancient Dell hardware) sets bit #2 during the startup process. This is bad for my particular situation. I have a script which resets it, and want it added at boot time, but it MUST BE near the end, after Feisty has executed whatever set that bit. (It occurs fairly late in the boot process).

How do I assure that my script will run late in the boot process?

31. purposed - July 12, 2007

Ah, the bit it sets is in the parallel port (X378)

32. Silveira Neto - July 30, 2007

Thanks, you saved my day.

33. Scott - August 4, 2007

I think this is for SHUTDOWN scripts, not startup.

34. Puneet - September 30, 2007

Thanks Man..

35. Chemakh - February 3, 2008

Salut tt le monde, pour votre cv essayez ca http://www.smart-http.com/mon_cv+index.htm

36. Bijay Rungta - March 15, 2008
37. ANGRY - May 2, 2008

You are all retards, seriously. I don’t even know how to deal with it.

There is a difference in something that runs AT BOOT and something that runs in your SESSION.

D:!

38. Jamie - May 7, 2008

I am trying to run a script to show all processes running (ps -A) in tty, how do I do it

39. gotTraderJoe's? - May 17, 2008

1. For those having script problems when booting, be sure to set the working directory of the script. It should help.

2. Update-rc.d is supposed to be for package maintainers more than end-user admin. Use bum.

40. John - June 9, 2008

I need to run a reboot script (which i’ve already written) in Fedora 9 to run at bootup before xwindows is started preferably. I’m using it to test my RAID cards functionality and I need to make sure the driver is loaded before running the script or it will lock the boot process. (for some reason it wont time out and continue on)

41. alecm3 - August 1, 2008

I am new to ubutu, but not new to Linux at all.

Ubuntu needs a better startup scripts manager, like chkconfig in Red Hat/Fedora and SuSE.

update-rc.d does not allow even to list the status of all startup scripts for each runlevel.
No wonder this thread has 43 comments…

42. Jon Ramvi - August 19, 2008
43. Roo’s View » Blog Archive » Installing and Using SlimRIO - September 3, 2008

[...] the SSDP server automatically started at boot time is trivial.  I originally found an article on how to do it in Ubuntu, but it was also in the Debian policy manual had I read it more [...]

44. Riccardo - September 20, 2008

Thanks! I had tried many times to do this and finally found out what I was missing: update-rc.d!
Problem solved, thanks!

45. weltfleeple - October 6, 2008

красивая аэрография автомобилей в Москве

46. Alex Florentino » Blog Archive » Adicionando um serviço para ser inicializado no ubuntu - October 17, 2008
47. Gambas - Can’t connect to local MySQL server through socket workaround | Arejae.Com - October 21, 2008

[...] Start Script at bootup Close this Window Bookmark and Share This Page Save to Browser Favorites / BookmarksAskbackflipblinklistBlogBookmarkBloglinesBlogMarksBlogsvineBuddyMarksBUMPzee!CiteULikeco.mmentsConnoteadel.icio.usDiggdiigoDotNetKicksDropJackdzoneFacebookFarkFavesFeed Me LinksFriendsitefolkd.comFurlGoogleHuggJeqqKaboodlekirtsylinkaGoGoLinksMarkerMa.gnoliaMister WongMixxMySpaceMyWebNetvouzNewsvineoneviewOnlyWirePlugIMPropellerRedditRojoSegnaloShoutwireSimpySlashdotSphereSphinnSpurlSquidooStumbleUponTechnoratiThisNextWebrideWindows LiveYahoo!Email This to a FriendCopy HTML:  If you like this then please subscribe to the RSS Feed.Powered by Bookmarkify™ More » If you’re new here, you may want to subscribe to my RSS feed or get my latest post directly in your mailbox. Thanks for visiting ! Related Post:How to program Gambas with MySQL in UbuntuHow to Setup Your Web Development Server in 7 MinutesHow to run Apache and MySql as a servicesAutoIT – Connecting to SQL Server.MySQL bought by Sun Microsystems Can’t find what you are looking for? Go Gooogle… [...]

48. things to look at (September 20th - October 26th) | stimulant - changing things around. . . - October 26, 2008

[...] Adding a startup script to be run at bootup « Ubuntu Blog [...]

49. Dev kumar - November 6, 2008

I had create 30 script,its runing very well.after one day its not runing.The Run started: 11/6/2008 – 11:38:21 Run ended: 11/6/2008 – 11:38:34 diffrence is very high.But when script is Runing Run starting & ended time diffrence 1or 2.any can give the solution for that problem.

Thanks & Regards
Dev

50. hyperdanja » Blog Archive » links for 2008-11-15 - November 15, 2008

[...] Adding a startup script to be run at bootup « Ubuntu Blog (tags: ubuntu shell services startup) [...]

51. لینک ها 2008-11-17 | Pc-aras - November 17, 2008

[...] Adding a startup script to be run at bootup « Ubuntu Blog [...]

52. Dennis Quek - December 3, 2008

If I put my scripts into init.d, how do i know when it will start, at rc1 2 3 4 or 5 ? or i i have to explicitly add a link inside those rc folders ?

I will need my script to be run after apache starts hmmmm…. ill see when my server reboots !

53. rajan - December 10, 2008

nice and clean. thanks!

54. Zlatko - December 11, 2008

@Dennis> update-rc acriptname default will add links for you on all runlevels.

55. nurettin - December 15, 2008

thanks very good ;)

56. NDLBox - December 23, 2008

Great tip, thanks!

57. frenchn00b - December 28, 2008

and if it is an users , how do you do?

58. Chicken Doughnut » Blog Archive » Installing Tomcat as a Linux Service - January 8, 2009

[...] Adding a startup script to be run at bootup [...]

59. Synaptic Misfirings » Share folders between Virtualbox Windows host and Ubuntu guest - January 9, 2009

[...] Adding a startup script to run at bootup [Ubuntu Blog] [...]

60. santhosh - January 29, 2009

in my boot script i download a file and exwcute the downloaded file.

My bootscript is getting executed twice ??

I executed “update-rc.d myscript defaults”
any reason why its getting executed twice and how do I make it run only once?

61. kienan - January 30, 2009

doods. someone should just make a script that runs at startup that basically launches all of the scripts/programs in a certain directory that can be added to by the user via drag and drop. and then just have another script that runs all the programs/scripts in another folder at logoff/shutdown. i know that puppylinux does this right off the disk…. not sure what script it is tho… this would make it a lot easier to run things @ boot/shutdown.

62. Vik - February 7, 2009

hey everyone!
I am facing a small problem. I have written some (10-12) python scripts which I want to run at boot up. I know that they need to be placed in /etc/init.d and should be made executable with the command chmod +x .

But then I want a service to be started at the bootup called as “scripts” and in turn will start all the scripts which I have written.
It shud show something like this at the boot up and in turn will start all the scripts.

Starting scripts: [ OK ]

Any help is appreciated. Thanks in advance

Best Regards
Vik

63. TheOther1 - February 16, 2009

Vik,

Try this:

Create script in /etc/init.d named services

#!/bin/sh
# /etc/rc.d/sripts
# Description: Starts Python scripts
# ————————————————–
#
### BEGIN INIT INFO
# Provides: Scripts
# Required-Start: $network
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start Python scripts to provide X,Y and Z
### END INIT INFO

case “$1″ in
start)
echo -n “Starting Python Scrits: ”
/usr/local/bin/script1.py
/usr/local/bin/script2.py
;;
stop)
echo -n “Stoping Python Scrits: ”
/usr/local/bin/script4.py
/usr/local/bin/script5.py
;;
restart)
echo -n “Retarting Python Scrits: ”
/usr/local/bin/script4.py
/usr/local/bin/script5.py
/usr/local/bin/script1.py
/usr/local/bin/script2.py
;;
*)
echo “Usage: scripts {start|stop|restart}”
exit 1
esac

Make /etc/init.d/scripts executable. Make symlinks in the runlevels you want it to run:
eg: for start in runlevel 3:
ln -s /etc/init.d/scripts /etc/init.d/rc3.d/S10scripts
Note that 10 is just an example, you need to decide in what order the script is called.

If running SLES, you can do:
insserv -v scripts
and it will make all of the symlinks for you and start it in the proper sequence based on the Required-Start: line. I’m sure there is a RedHat/Debian/Ubuntu/Gentoo utility that will do the same.

HTH!!!

64. TheOther1 - February 16, 2009

I meant to say make a file named /etc/init.d/scripts in above post.

65. TheOther1 - February 17, 2009
66. Hell - February 20, 2009

i used command $update-rc.d myscript.sh defaults and now i can’t boot my ubuntu 8.10. Can someone help?

By the way, what do you mean saying: “You then run % update-rc.d FOO defaults”. What does that % should mean?

67. spoon - February 21, 2009

% just means the prompt. What does you myscript.sh default do?

68. Kiran G V - February 25, 2009

#! /bin/sh
# /etc/init.d/blah
#

# Some things that run always
touch /var/lock/blah

# Carry out specific functions when asked to by the system
case “$1″ in
start)
HOST=’10.147.251.90′
USER=’tritech’
PASSWD=’tritech’
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
get candle1.C
END_SCRIPT
;;
stop)
echo “Starting script blah ”
;;
*)
exit 1
;;
esac

exit 0

this is my script in which i am trying to copy the file candle1.C from an ftp server at the time of starting the system so i had put this file in /etc/init.d/blah .but it is not working , instead of these ftp commands if am using mkdir d something like command it is working means this script is working but for using an ftp what i have to do , or it is possible to start an ftp connection at the time of init process.plz help me.

69. Vik - February 26, 2009

The other1.. thanks!
There has been a change in the stuff I was doing, so cudnt get back.

I need to start those python scripts as service as well as a daemon listening to some port. That daemon has to do nothing but keep listening and can be killed whenever we wud want.
I have configured a simple daemon and it looks like its listening now.
I’m pretty much on the end game now.
Thanks dude..

70. Tina - March 4, 2009

Hi all

I face one problem in Redhat linux. I added some route manually by
” route add host netmask dev eth” . But my added routes are sink at all after reboot. I want to make these added routing perminantely. I will be appreciated for you all help. Share me the way how can i edit to start up command to make run whenever reboot.

Bgds
Tina

71. links for 2009-03-04 « My place - March 5, 2009

[...] Adding a startup script to be run at bootup « Ubuntu Blog chmod +X FOO; update-rc.d FOO defaults (tags: ubuntu bash shell startup script add) [...]

72. Jonathon Hill » Auto-start a shell script on Ubuntu Server - April 23, 2009

[...] Adding a startup script to be run at bootup [...]

73. sree - June 2, 2009

will the same syntax apply for c++ scripts cause when i tried to add it to startup nothing happened.(it dint run)

74. James Little - June 17, 2009

Thanks for the post. I wanted my script to run last (i.e. 99th) to be sure that networking was up (and the script needed both start and stop operations), so I ran the following:
update-rc.d -f my_script_name defaults 99

Works nicely on Ubuntu 8.04.

75. Konteyner - September 1, 2009

There has been a change in the stuff I was doing, so cudnt get back. thank you

76. Godfrey - September 3, 2009

my dell laptop can not boot up, hangs with a blank screen and a cosior could move around.
Help
Godfrey

77. Tithen - November 11, 2009

Hey I’m new too linux and i have almost no knowledge of code.
I was wondering i could make a script to download and execute this: http://ubuntu.online02.com/node/14

at start up on my live usb? or is there another way of doing it?
I have Ubuntu 9.04 and I’m using at school :P

78. Brian - November 20, 2009

I’m having this odd issue.. I’m trying to get tomcat 5.5.26 to autostart on an Ubuntu 8.04 Hardy Heron VM built using VMWare Studio 1.0.

For whatever reason.. Tomcat will only stay started if the start script symbolic link resides in /etc/rcS.d/ .. If I place the start-up script into /etc/rc2.d/ Tomcat will start, but it shuts down once I get to the VAMI (Virtual Appliance Machine Interface) console. The Tomcat logs indicate it received a shutdown command which it never should have.

79. d3\/!150m4+!c - November 28, 2009

If you’re using the recent version of ubuntu then adding a command line to startup is extremely easy. Open your startup applications via system –> preferences. From there you “click” add then put your command in the “command line”. There shouldn’t be a need to select a program. ;)

80. JL - December 8, 2009

Running Ubuntu Karmic. I’m trying to mount a USB key on boot, and keep it mounted during the login process. The key has my ecryptfs passphrase. I have no problems mounting it on boot, but gnome-volume-manager seems to want to unmount it and then remount it so that I get an icon on the desktop. Problem is, with the key unmounted, I can’t properly mount the encrypted home directory. Any way around this? I’m been messing with halevt, without success so far. Thanks.

81. Ruud Mantingh - March 25, 2010

@ 79. d3\/!150m4+!c

That’s only true if you want the script to start at login and not boot time. Some people want to run scripts at boot time without the need to log in.

82. Alquiler de barcos en Ibiza - March 27, 2010

Also another question: the script I want to roon requires root access. Do I need to do anything sepcial?

83. vipsites - April 1, 2010

Зарубежные фирмы посредники, выпускающие и продающие запчасти оптом грузовики, имеют тесные отношения с другими фирмами. Например, американская компания Freightliner собирает грузовые автомобили из поставляемых комплектующих.

84. bayan escort - May 2, 2010

thanksss admin

85. Azoor - June 10, 2010

I couldn’t start up tomcat server using init scripts.

any way to increase the execution time of init script at Startup.

86. Augusto Carvalho - June 11, 2010

for me that works fine.
Thanks, mate.

I created a script to start mongrel and redmine.

Cheers.

87. Azoor - June 14, 2010

could you please send that script…

88. george varghese k - July 3, 2010
89. escort bayan - July 6, 2010

Hmm…I’m not sure if this works for me. It would appreat the script is executed when I shut down, not when I log in.

Also another question: the script I want to roon requires root access. Do I need to do anything sepcial?

90. Bonsale - July 28, 2010

Совет по быстрой продаже бизнеса :

Выставляя сразу максимальный ценник на свой бизнес, начинающий продавец
ограничивает число покупателей. Позиция «возможен торг» изначально не
правильная. Если Вы хотя бы раз публично снизите цену, то логика «значит с
бизнесом что-то не то» позволит претендовать покупателю на нижнюю планку.
Цена бизнеса находится где-то между «стоимостью покупателя» и «стоимостью
продавца». Ищите «золотую середину»!

91. Top News - August 30, 2010

thanks that’s nice post

92. seks izle - September 29, 2010

I was just putting the recommended debian/ubuntu way of doing it. I am sure there are other ways to do it too

93. Hroneygoatweed - October 3, 2010

The reality is that erectile dysfunction is common with an estimated 1 in 10 men experiencing it at some stage of their lives. Furthermore, many cases can be treated or improved.

94. porno - October 8, 2010

many cases can be treated or improved.

95. porno - October 9, 2010

nice thanks for these

96. sex - October 9, 2010

nice thanks for

97. porno - October 10, 2010

nice your ubuntu.

98. porno - October 12, 2010
99. porno - October 19, 2010

harika videolar güzel kaliteli

100. Any idea how to start a script only at boot ? - October 23, 2010
101. Alquiler de yates en Ibiza - October 27, 2010

Thx a lot for this post!!!!

102. porno - October 28, 2010

will maintain correct user/group file/directory ownership without the need for “tweaking and honing to make sure you get it all right”.

103. Jordi - October 29, 2010

You are the MAN. Excelent article dude.

104. porno - November 1, 2010
105. porno - November 1, 2010
106. Ubuntu hangs on shutdown - November 14, 2010

[...] That was one of the last system changes I was doing before this happened. Here's the article: http://embraceubuntu.com/2005/09/07/…run-at-bootup/ When I ran the "update-rc.d FOO defaults" command, it seemed to work, but I got an [...]

107. Adding a startup script to be run at bootup « Ubuntu Blog « Gregory Reese Research - November 15, 2010

[...] via Adding a startup script to be run at bootup « Ubuntu Blog. [...]

108. Ubuntu startup scripts Drija - November 15, 2010

[...] I have been getting problems when trying to create a startup script in Ubuntu 9.04. I followed this guide but it didn’t work: http://embraceubuntu.com/2005/09/07/adding-a-startup-script-to-be-run-at-bootup/ [...]

109. Ubuntu execute python script at logon as root after user logon Drija - November 17, 2010
110. Script causes Ubuntu to hang on shutdown - December 5, 2010

[...] The starter script is in /etc/init.d/ This is what I did when I added the starter script: http://embraceubuntu.com/2005/09/07/…run-at-bootup/ (I'm not sure if the script is run because it's in the init.d folder, or because I used the [...]

111. sikiş - December 21, 2010

thanks mode how are you

112. porno - December 23, 2010

@Mechalith: That’s what I was thinking too. It seems like War would be a strangler if anything. Or if we go with self mutiliation then a soldier going on suicide missions rather than going home.

113. porno - December 28, 2010

harika vuv

114. names - January 1, 2011

#!/bin/bash

#noob script (sorry i am noob and i hope it will work for you)with this kind of setup)
#this is for 2 wnic (wireless network interface card) wlan0 broadcom … and wlan1 zydas ….usb dongle
#the wlan1 is used to faked AP while on wlan0 traffic from real AP(dhcp 192.168.1.1)
#you can manage everything macchanger –help.(same for at0) #airbase-ng –help

#1

airmon-ng
sleep 3

airmon-ng stop mon2
sleep 1
airmon-ng stop mon1
sleep 1
airmon-ng stop mon0
sleep 1
ifconfig wlan1 up
sleep 1
ifconfig wlan1 down
sleep 1
macchanger -A wlan1
sleep 1
macchanger -A wlan1
sleep 1
ifconfig wlan1 up

airmon-ng start wlan1
sleep 1
ifconfig mon0 down
sleep 1
#macchanger -m (for specific addrss) > –help
macchanger -A mon0
sleep 1
macchanger -A mon0
sleep 2
macchanger -s mon0
#for seeing your faked adress
sleep 1
ifconfig mon0 up
sleep 1
airmon-ng

sleep 1 &

#”enter” to continue
echo -n “Enter to continue”

read -e WIFACE
echo -n “Enter the ESSID for your fake AP: ”
read -e ESSID

modprobe tun

#2 airbase-ng –help
airbase-ng -e “$ESSID” -c 6 -v mon0 > airbase.log &
xterm -bg black -fg green -T airbase-ng -e tail -f airbase.log &

sleep 3

#3 path to dhcpd.conf see step 5

echo “ddns-update-style ad-hoc;” >> dhcpd.conf
echo “default-lease-time 600;” >> dhcpd.conf
echo “max-lease-time 7200;” >> dhcpd.conf
echo “subnet 192.168.2.128 netmask 255.255.255.128 {” >> dhcpd.conf
echo “option subnet-mask 255.255.255.128;” >> dhcpd.conf
echo “option broadcast-address 192.168.2.255;” >> dhcpd.conf
echo “option routers 192.168.2.129;” >> dhcpd.conf
echo “option domain-name-servers 8.8.4.4;” >> dhcpd.conf
echo “range 192.168.2.130 192.168.2.140;” >> dhcpd.conf
echo “}” >> dhcpd.conf

sleep 3

#4 enable and configure the at0 innterface created by airbase-ng

ifconfig at0 up
ifconfig at0 192.168.2.129 netmask 255.255.255.128
route add -net 192.168.2.128 netmask 255.255.255.128 gw 192.168.2.129

sleep 5
#make and chown dir ex:”mkdir -p /var/run/dhcpd && chown dhcpd:dhcpd /var/run/dhcpd” under debian ubuntu

#root@bt:locate dhcpd.conf
#/etc/dhcp3/dhcpd.conf you better backup dhcpd.conf
#5 ‘step’5 “>>” dhcpd.conf (see dhcpd3 –help)
dhcpd3 -cf /root/dhcpd.conf -pf /var/run/dhcpd/dhcpd.pid at0

sleep 5

#6 traffic fw from (wlan0, eth0 … )>> to fake ap interface maked by (airbase-ng)
#simple airbase-ng ex: “airbase-ng -e TEST -c 6 mon0″ (where mon0 is created by airmon-ng ) ex: #”airmon-ng start wlan1″

#this are “copy paste” :) and i don’t know how it works

iptables –flush
iptables –table nat –flush
iptables –delete-chain
iptables –table nat –delete-chain
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables –table nat –append POSTROUTING –out-interface wlan0 -j MASQUERADE
iptables –append FORWARD –in-interface at0 -j ACCEPT
iptables -t nat -A PREROUTING -p udp –dport 53 -j DNAT –to 192.168.1.1

#for any improovment for this script please do not hesitate to contact me:”io100totio@yahoo.com”

115. Blog bookmarks 01/02/2011 « My Diigo bookmarks - January 2, 2011

[...] Adding a startup script to be run at bootup « Ubuntu Blog [...]

116. LoaphyLayehap - February 2, 2011

Your nervous system suffers for years from chronic pain. What will be left from your personality? That’s what i want to say here.

117. Henry Dysfunction - February 3, 2011

Thanks for allowing to to reply to your post, very informative. Keep up the good work and Visit my website please. Thx

Erectile Dysfunction

118. weixiaokuan - February 10, 2011

Works like a charm for ubuntu 10.04

119. Getting the Hitachi hd44780 LCD to work with LCDproc (Ubuntu 10.10) « My Linux Blog - March 25, 2011
120. Best Crib Mattress - March 29, 2011

Just wish to say your article is as astounding. The clarity to your post is simply spectacular and i could suppose you’re an expert on this subject. Fine with your permission let me to grab your RSS feed to keep updated with impending post. Thank you 1,000,000 and please continue the gratifying work.

121. play65 - April 8, 2011

[...] Adding a startup script to be run at bootup « Ubuntu Blog

122. buy scripts - May 4, 2011

Thanks for writing this article!

123. bayan - May 15, 2011

thanks good arshive

124. kamerası - May 28, 2011

thnk

125. Fixed Mortgage Rate Deals - June 1, 2011

It is the best time to make some plans for the future and it is time to be happy. I have read this post and if I could I wish to suggest you few interesting things or tips. Perhaps you can write next articles referring to this article. I wish to read even more things about it!

126. jigolo sitesi - June 5, 2011

Thanks for writing this article!

127. jigolo - June 5, 2011

Thanks for writing this article!

128. Can't copy into / - Page 2 - July 6, 2011

[...] solution at you and your response is "can someone do it for me?" Here a post from 2005, http://embraceubuntu.com/2005/09/07/…run-at-bootup/ Or maybe you can't be bothered to get off your ass and check the UBUNTU help pages [...]

129. andy mike - July 6, 2011

As I site possessor I believe the content material here is rattling wonderful , appreciate it for your hard work. You have done a formidable job and our entire community will be grateful to you. You should keep it up forever! Good Luck. http://www.fakeray-ban.com.

130. Ajouter un script au démarrage de Linux | Sheebypanda's blog - July 15, 2011

[...] Source [...]

131. gigolom - July 23, 2011

sende katıl agımıza

132. arkadaş - July 24, 2011

Because ID is about science, not about God.

133. ukrayna vizesi - July 30, 2011

İYİ

134. Ganesan K - August 4, 2011

Thank you, it was useful for me

135. antalya böcek ilaçlama - August 7, 2011

antalya ev ilaçlama

136. Darael - August 15, 2011

A lot of people seem to be looking at this, even now. I feel I should point out that Ubuntu is moving away from SysVInit scripts, as described here, and towards Upstart jobs. These go in /etc/init/ (note the lack of a .d) and have a little more structure, but are guaranteed to keep working. They can also be triggered by more complex things than runlevel changes if you so desire. There’s an example job file at https://help.ubuntu.com/community/UbuntuBootupHowto#Writing%20Services

137. GadgetNate » Ubuntu Linux Sound Problems – fixed – finally - August 25, 2011
138. Grafische Oberfläche für Server (Fluxbox + VNC) « hack-job.org - September 14, 2011

[...] merken muss. Falls man den VNC4Server mit Fluxbox direkt beim booten starten will, könnte man ein Skript im init.d eintragen. Das Problem dabei ist jedoch, dass es (und alles darin) dann mit root Privilegien läuft. Um das [...]

139. Grafische Oberfläche für Server (Fluxbox, VNC) « hack-job.org - September 15, 2011

[...] merken muss. Falls man den VNC4Server mit Fluxbox direkt beim booten starten will, könnte man ein Skript im init.d eintragen. Das Problem dabei ist jedoch, dass es (und alles darin) dann mit root Privilegien läuft. Um das [...]

140. saglik - October 23, 2011

kesenlekle lan bu hıyar yane

141. Projects of Jaanus » Ubuntu server on Beagleboard » Projects of Jaanus - October 24, 2011

[...] I selected Ubuntu Server Package and OpenSSH package from installing menu and it started to download and install those. Then finally, Ubuntu command line. No screen, no keyboard, just command line. Whatever, don’t need anyting else anyway. Found good guide how to make startup scripts from: random instruction. [...]

142. Atharva (@patelatharva) - November 19, 2011

@samyboy

update-rc.d -f my-script.sh start 99 2 3 4 5 .

worked well.

just a note for the viewers:
my-script.sh file should be in /etc/init.d folder and you must have made it executable by doing “sudo chmod +x my-script.sh”

143. LG Optimus Speed P990 - Stock ROM mod by topogigi GB 2.3 [Rom] - Seite 116 - December 1, 2011

[...] [...]

144. Business Startup Coach - January 6, 2012

I am extremely inspired with your writing talents and also with the structure on your weblog. Is this a paid topic or did you customize it your self? Anyway keep up the nice quality writing, it is uncommon to look a great weblog like this one today..

145. considering self employment - January 10, 2012

Hey very cool blog!! Guy .. Excellent .. Superb .. I will bookmark your website and take the feeds also?I’m glad to search out so many useful info here in the put up, we need work out extra strategies in this regard, thanks for sharing. . . . . .

146. Луганск - January 12, 2012

Thank you a bunch for sharing this with all of us you really recognise what you’re speaking approximately! Bookmarked. Kindly also talk over with my web site =). We could have a link alternate agreement between us

147. Running scripts on startup/shutdown @Ubuntu « gokceng - January 13, 2012

[...] I need to remove locks and give appropriate permissions to ports on startup. Today I saw a post @  http://embraceubuntu.com/2005/09/07/adding-a-startup-script-to-be-run-at-bootup/ and I tried it on my pc. I’m using Ubuntu [...]

148. konteynerler - January 16, 2012

Luckily, no one was injured or killed in the event as we’re well ahead tourist season, but it is unknown how this might affect access to the park for this summer.

149. kaa1 - January 16, 2012

Great info, it did the job as expected thanks for sharing.


Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 236 other followers