LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 06-01-2006, 06:23 PM   #1
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Rep: Reputation: 15
Make a script run at reboot


Hello,
So i want to run some scripts automatically after reboot. I use Ubuntu 6.06 RC.
I have tried to place it in the /etc/init.d directory but the script cannot run because it needs additional files (example: 'Unable to open dat/userlist.db! Aborting connection')
So how can i make it happen?
 
Old 06-01-2006, 08:21 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
Depending on your system, it goes in init.d--AND must be linked somewhere. In my system, it's one of the rcX.d directories.
<<edit--just noticed that you have Ubuntu also--look in /etc for a string of directories rc1.d, rc2.d, etc.>>

As for this:
Quote:
'Unable to open dat/userlist.db! Aborting connection'
We can't help you if we don't know what the file is that it is trying to access.

Hint: Get the script working before you try putting it in your startup routine.

Last edited by pixellany; 06-01-2006 at 08:23 PM.
 
Old 06-02-2006, 12:01 AM   #3
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Original Poster
Rep: Reputation: 15
In the rc1.d i have things like
Code:
lrwxrwxrwx  1 root root   15 2006-05-31 21:44 K25mdadm -> ../init.d/mdadm
So i don't know how to add it.
The script is Darkbot, a eggdrop for mIRC and it's working fine IF i start it from it's own directory /home/me/darkbot.

Last edited by Braynid; 06-02-2006 at 12:44 AM.
 
Old 06-02-2006, 12:19 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
Ok--where is the file that it is trying to open? Could it be that it wants that file to be in the same directory? (You may have to go into the script to see how the file is called.)

To set up the init scripts:
init goes to one of the rcx.d directories depending on what runlevel is selected--eg runlevel 5 for the full GUI. In the rcx.d directory, there are links to the actual scripts in init.d The links have a special format: K means kill, S means start--then the numbers are used to control the order in which things are started.

Example: you will be booting into runlevel 5 and you want to start the script "sally":
put the script in init.d and make sure it is executable
in rc5.d, run "ln -s ../init.d/sally S##sally, where ## is a number that will put it in the right sequence. The default would be to put it after all the other "S"s in the folder.

"man init" for more details......and peruse the various links and scripts to get a feel for what is happening.
 
Old 06-02-2006, 12:26 AM   #5
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
The easy way is to add a line at the top of your crontab

@reboot script_file_goes_here
 
Old 06-02-2006, 12:51 AM   #6
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Original Poster
Rep: Reputation: 15
@pixellany - the problem is that my script it's not a single file, it has dependencies and ai cannot just put the ./darkbot file in init.d because when i do i get the given error:
Code:
'Unable to open dat/userlist.db! Aborting connection'
@billymayday - given what i have stated above: How and where do i modify crontab?

Thanks for the support, I'll try now a few things and i am expectig your opinions!

P.S: I have tried to edit the ./darkbot file to edit paths but it's not editable (not in understandable format)
P.P.S: I don't use GUI at all, i have the Server 6.06 RC edition

Last edited by Braynid; 06-02-2006 at 12:55 AM.
 
Old 06-02-2006, 02:01 AM   #7
Braynid
Member
 
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Original Poster
Rep: Reputation: 15
Ok, sorry for spam but:
I have done it! I have created a script like:
Code:
cd /home/me/program/
./program
So it just execute the script from it's own directory. The resulting script i have added to init.d and it works!
Thanks for the sugestions and help!
 
Old 06-02-2006, 02:12 AM   #8
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
For future reference, to edit crontab, you just type

crontab -e

as root

The edit commands are then the same as vi

To be clear, you don't need to find a file called crontab, type as given above
 
Old 06-26-2006, 10:34 AM   #9
odole
LQ Newbie
 
Registered: Jun 2006
Posts: 2

Rep: Reputation: 0
Post Starting Sybase Server at Startup & Backup

Please, I am a newbie in this linux stuff. I want my sybase database to start automatically when the OS starts and stops when bringing down the OS. I use Red Hat Linux 9.

Also, I am trying to configure my RHL9 for backup. I have a DLT8000 tape drive attached to it and want now to backup some files from my HP-UX box. Please, what can I do to achieve this.

Thanks for your anticipated reply.

Solomon M.O.
 
Old 06-26-2006, 10:38 AM   #10
odole
LQ Newbie
 
Registered: Jun 2006
Posts: 2

Rep: Reputation: 0
Post Starting Sybase Server at Startup & Backup

Please, I am a newbie in this linux stuff. I want my sybase database to start automatically when the OS starts and stops when bringing down the OS. I use Red Hat Linux 9.

Also, I am trying to configure my RHL9 for backup. I have a DLT8000 tape drive attached to it and want now to backup some files from my HP-UX box. Please, what can I do to achieve this.

Thanks for your anticipated reply.

Solomon M.O.
solomonolawale@yahoo.com
 
Old 06-26-2006, 11:10 AM   #11
binary_y2k2
Member
 
Registered: Jul 2005
Location: England, UK
Distribution: Ubuntu 8.04 Server, Kubuntu 12.04
Posts: 698
Blog Entries: 1

Rep: Reputation: 31
odole, Please start a new thread or members won't be able to find your post.
Maybe put it in the Red Hat Forum
 
  


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
how do i make a script run on login? roseplant Suse/Novell 11 01-24-2006 05:09 PM
Can't make a script run hanasi Linux - Newbie 14 08-27-2005 04:14 PM
How do I make a script run at boot? ToothlessRebel Linux - Newbie 9 04-27-2005 02:46 AM
make hotplug run a script on detect bobbens Linux - Software 5 01-13-2005 12:42 PM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 10:34 AM


All times are GMT -5. The time now is 11:49 AM.

Main Menu
Advertisement
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