Load .sh file on Linux Ubuntu startup
Hey guys,
I wanted to do this a long time ago, but I guess I just forgot. But now when it's 6 AM and I have to wait until my server will reboot - Well, kind of annoying.... So. I have a .sh file, which contains Shell commands. I basically created one, so when server starts up, I wouldn't have to type all commands my self, but just type ./startup.sh and everything would ok. So. I'm accessing my server ( Ubuntu 6.10 ) through PuTTy, and I Was wondering - if there is a chance, to add the startup.sh file to Autostart. Thank you. |
Not sure what you mean by "autostart" but if you want a bash script to run at login then you can put it in your ~/.bash_profile file. Or if you need it for all users then in /etc/profile file. If you have questions about this just ask.
Thanks, James Glenn www.thedonkdonk.net |
If you mean on system startup there are two easy ways I can think of off of the top of my head.
a) Add a call to the file in the file to /etc/rc.local b) Call the file as a cronjob by using the command "crontab -e" and the "time" of @reboot . I.E Code:
[user@localhost ~]$ sudo crontab -e |
This article will help you achieve your goals. Basically you need to copy startup.sh to /etc/init.d and rename it to startup. After that do "update-rc.d startup defaults" so that its automatically run at boot up.
|
All times are GMT -5. The time now is 06:13 PM. |