LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-26-2005, 12:47 AM   #1
sirrus_linux
LQ Newbie
 
Registered: Sep 2004
Location: India
Distribution: Fedora Core 2
Posts: 11

Rep: Reputation: 0
need for a script file


Hello,

I am totally lost when it comes to writing automated scripts in linux !

I need to excute a set of commands everytime that my linux router box boots up. So can anyone help me by giving some examples of how to mount the floppy drive ( there is an entry in the /etc/fstab ) and run a set of commands from the floppy drive to excute a software which is in the floppy drive.

Thanks ..... in advance.
 
Old 02-26-2005, 01:23 AM   #2
purefan
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Ubuntu 10.04
Posts: 99

Rep: Reputation: Disabled
hello!
Well I know very little about writing scripts but I found some useful information here:
http://www.atnf.csiro.au/people/rgoo.../boot-scripts/
it basically talks about implementation run-levels and what to modify.
I hope it is of some use to you,
good luck
 
Old 02-26-2005, 01:24 AM   #3
musicman_ace
Senior Member
 
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555

Rep: Reputation: 46
You'll have to create a script. Place it in /etc/rc.d or /etc/init.d and make it executable. The script code would look something like what is typed below. Since you didn't specify what is being run on the floppy, I just called them command1, command2, and anothercommand. Whatever executable you wish to run, make sure that the ./ is in front of it, or use the full path like the last command.


#!/bin/bash

# Mount the floppy
mount -t vfat /dev/fd0 /mnt/floppy

# Change to floppy and run commands
cd /mnt/floppy
./command1.script
./command2.script
/mnt/floppy/anothercommand.script

Last edited by musicman_ace; 02-26-2005 at 01:25 AM.
 
Old 02-26-2005, 01:32 AM   #4
purefan
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Ubuntu 10.04
Posts: 99

Rep: Reputation: Disabled
Quote:
...etc/rc.d or /etc/init.d and make it executable
I read that the /etc/rc.d is like the "orchestator" and it is for such saying the main script, it runs all other scripts, is this correct or did I missunderstood??
also I have another question:
what does it mean to make it executable??
Thanks and im sorry if im being annoying but I am really new to this and very anxious to learn
 
Old 02-26-2005, 01:46 AM   #5
musicman_ace
Senior Member
 
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555

Rep: Reputation: 46
Quote:
Originally posted by purefan
I read that the /etc/rc.d is like the "orchestator" and it is for such saying the main script
I would agree with that statement. The scripts are what get executed when a runlevel is changed, meaning if you shutdown, reboot, boot up, or change to a different runlevel for maintainance or something.
 
Old 02-26-2005, 06:37 AM   #6
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,586

Rep: Reputation: 145Reputation: 145
u can make a script executable by
chmod 0755 /path/to/script

after that u can invoke the script as a program.

/path/to/script

from the shell

Last edited by j-ray; 02-26-2005 at 06:38 AM.
 
Old 02-26-2005, 02:05 PM   #7
purefan
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Ubuntu 10.04
Posts: 99

Rep: Reputation: Disabled
Thank you very much!
You have cleared my doubts
 
Old 02-27-2005, 02:15 AM   #8
sirrus_linux
LQ Newbie
 
Registered: Sep 2004
Location: India
Distribution: Fedora Core 2
Posts: 11

Original Poster
Rep: Reputation: 0
Thank you very much guys !

You have helped me solve my problem promptly.

Thank you very much again.
 
  


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 to start a Tcl/Tk script by simply invoking the script file itself ? cyu021 Programming 2 10-10-2004 12:00 PM
Help with script file hilljack13 Linux - Newbie 3 05-13-2003 08:33 PM
help me with this script file alaios Linux - General 11 05-03-2003 03:29 AM
Script that appends a file to start of other file amp2000 Programming 8 06-30-2002 10:56 AM
Script, Reading a file, When end of file? elibm Programming 2 07-16-2001 12:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:43 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration