LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 12-31-2007, 11:01 PM   #1
Fired501
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 ./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.
 
Old 01-01-2008, 04:14 AM   #2
thedonkdonk
Member
 
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.

Thanks,
James Glenn
www.thedonkdonk.net
 
Old 01-01-2008, 04:30 AM   #3
Deleriux
Member
 
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 .

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

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


Reply


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 01:32 PM
speeding up linux ubuntu startup Micik Ubuntu 3 06-10-2006 05:50 PM
Startup file on debian linux x86_64, looking to edit Wolvenmoon Linux - Software 1 08-19-2005 09:29 AM
Load on Startup ShadowPeo Linux - Newbie 1 02-01-2003 07:53 PM
Automating Linux/Win file sharing on startup deesto Linux - Networking 11 09-11-2002 12:59 PM


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

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