View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 01-01-2008, 12:01 AM   #1
LQ Newbie
Registered: Nov 2005
Location: Latvia
Distribution: Ubuntu Linux 6.10
Posts: 18

Rep: Reputation: 0
Question 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 ./ 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 file to Autostart.

Thank you.
Old 01-01-2008, 05:14 AM   #2
Registered: Oct 2005
Location: San Antonio, TX
Distribution: Fedora, RHEL 6, CentOS 6, Debian 6, Arch, Gentoo
Posts: 136

Rep: Reputation: 16
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.

James Glenn
Old 01-01-2008, 05:30 AM   #3
Registered: Nov 2003
Posts: 89

Rep: Reputation: 16
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 .

[user@localhost ~]$ sudo crontab -e
0  0  *   *   *     sh /usr/loca/bin/
@reboot             sh /usr/local/bin/
Old 01-01-2008, 06:09 AM   #4
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 74
This article will help you achieve your goals. Basically you need to copy 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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to make a link from word in one file to a different file using Ubuntu linux gilbert.baumslag Linux - Newbie 3 01-11-2008 02:32 PM
speeding up linux ubuntu startup Micik Ubuntu 3 06-10-2006 06:50 PM
Startup file on debian linux x86_64, looking to edit Wolvenmoon Linux - Software 1 08-19-2005 10:29 AM
Load on Startup ShadowPeo Linux - Newbie 1 02-01-2003 08:53 PM
Automating Linux/Win file sharing on startup deesto Linux - Networking 11 09-11-2002 01:59 PM

All times are GMT -5. The time now is 10:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration