LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 04-25-2005, 03:59 AM   #1
bnj
Member
 
Registered: Apr 2005
Location: Switzerland
Distribution: Ubuntu
Posts: 70

Rep: Reputation: 16
where to write a startup script


Hello,

I would like to write a startup script because I have made a copy of my linux distro on my hard drive and I would like it to be mounted automatically when my PC starts up.

Where should I put this script?

I have seen many pages mentioning that startup scripts should be in /etc/init.d/rc<X>.d/, where <X> can be a number between 0 and 6, or S. In which on these directories should I put my script?

My script would be only two lines:

#!/bin/bash
mount -o loop -t iso9660 /data/SuSELinuxPro9.3 /suse

Is it sufficient if I:
- login as root (su)
- copy this script in the correct directory (say, /etc/init.d/rc0.d/, for example)
- make it executable (chmod 744 myscript.sh)
??

Or will it somehow harm my computer.

Thank you for your answer.

I run SuSE 9.3 Professional
On a standard PC.
 
Old 04-25-2005, 04:22 AM   #2
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 54
A bit easier to use /etc/fstab for automounting. Have a look at the lines you already have there and add auto to the options for the partition to have it automounted.
 
Old 04-25-2005, 04:22 AM   #3
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
The X depends on the runlevel you start in. You can see this on the "default runlevel" line in /etc/inittab.

But in your case, for mounting an ISO file, the proper place to put this is probably /etc/fstab. You would add a line about like this:
Code:
/data/SuSELinuxPro9.3 /suse iso9660 loop 0 0
I'm not sure about the syntax, though. I don't have Linux at hand right now.

Yves.
 
Old 04-25-2005, 07:24 AM   #4
uzairkhan
Member
 
Registered: Apr 2005
Location: Islamabad, Pakistan
Distribution: Mandrake 10.0 & Window XP professional
Posts: 32

Rep: Reputation: 15
soory if i sound dumb

hi,
i am just a linux newbie and was going through this post and a couple of questions popped up. hopefully u would be able to help


a ) why are u mounting the iso image in the first place, i mean like can you use the os on it after mounting or what ???


b ) if i mount an iso image this way, can i get the system to boot from like, if i dont have a bootable cd , but i do have boot images and dont want to boot from a floppy for some reasons.

i would really appreatiate if u could help me out on this...
 
Old 04-25-2005, 10:39 AM   #5
bnj
Member
 
Registered: Apr 2005
Location: Switzerland
Distribution: Ubuntu
Posts: 70

Original Poster
Rep: Reputation: 16
Hello uzairkhan,

The reason why I wanted to do this is that I regularly use YaST to install new packages. And I don't want to be obliged to insert SuSE's DVD each time I want to install a new package. So I followed the instructions on this page:
http://www.novell.com/coolsolutions/feature/8973.html
But I wanted to have the images mounted automatically, so that I don't have to log as root and do it "by hand" each time I use YaST.

Note: YaST is a tool on SuSE. If you use another distribution, there might be other reasons to be willing to mount an iso image.

I don't know anything about trying to boot from such an image. Sorry about that.
 
Old 04-25-2005, 10:49 AM   #6
uzairkhan
Member
 
Registered: Apr 2005
Location: Islamabad, Pakistan
Distribution: Mandrake 10.0 & Window XP professional
Posts: 32

Rep: Reputation: 15
thanx
 
Old 05-27-2005, 08:10 AM   #7
bnj
Member
 
Registered: Apr 2005
Location: Switzerland
Distribution: Ubuntu
Posts: 70

Original Poster
Rep: Reputation: 16
Hello hello,

I realize today that nobody has actually answered my question yet.

Where should I put a script that I want to be executed at startup time?

I have written a litte shell script, copied it in the directory /etc/init.d/ and a link to it in /etc/init.d/rc5.d/.
The script is executable.

To test it, It writes a little output in a file in the root's home directory.

I have rebooted my PC -> nothing has happened.

This time, my goal is to launch a script that updates my dynamic DNS server (dyndns.org). I use the program called inadyn.

Thank you,

Benjamin
 
  


Reply



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
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM
How to call a script from a system startup script? jonatito Linux - Newbie 7 11-11-2005 09:40 PM
How to write startup script to run NTFS neosirex Linux - Newbie 4 05-31-2005 07:25 PM
Auto mounting drives with write access at startup hongman Linux - Newbie 7 02-27-2005 11:32 AM
trying to write a startup script psytae Debian 5 09-09-2004 09:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:18 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
Open Source Consulting | Domain Registration