LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 02-25-2005, 04:59 PM   #1
slackwbas
LQ Newbie
 
Registered: Feb 2005
Distribution: slackware 10.2,Fedora 4, FreeBSD 5.4,Win vista beta
Posts: 22

Rep: Reputation: 15
auto execute shell script on startup


hi.i have a question about how to execute a shell script on start up..
the shell script is for my usb modem alcatel speedtouch. to establish the connection
and here its the shell script

echo "Starting Speed touch connection script [by Darkflow]"
echo "Getting ready to start USB modem and mounting USB device file systems..."
modprobe ppp_generic
modprobe ppp_synctty
modprobe n_hdlc
mount none /proc/bus/usb -t usbdevfs
echo "Done"
echo "Loading Speedtouch modem Firmware (will take around 30 seconds)..."
modem_run -f /etc/ppp/microcode.dat
echo "Connecting: ADSL with pppd..."
pppd call adsl updetach
echo "Done. You are now online."

and i tried to edit /etc/rc.d/rc.S and put /myshell.sh in the rc.S
to start on boot...but the problem is that the shell script starts but its didnt connect
and sayed conection terminated...but when i start this script after login to the sys its works
well...some one told me that i should use startproc command or startdaemon
so i should edit the rc.S and put
startproc -s /myshell.sh
and i have slackware 10.0 ..and there is no startproc in it
....any body have any idea ??
thanx
 
Old 02-25-2005, 05:05 PM   #2
tank728
Member
 
Registered: Sep 2003
Posts: 142

Rep: Reputation: 16
The file you need to edit is /etc/rc.d/rc.local
just add
Code:
/path/to/myshell.sh
and you should be ready to go. You might
consider using the `&` to run it in the
background, if it is going to take a long time.

-tank
 
Old 02-25-2005, 05:10 PM   #3
kostian
Member
 
Registered: Jul 2004
Location: LT
Posts: 150

Rep: Reputation: 15
try /etc/rc.d/rc.local
when rc.S is executed the system is in singeluser mode and network services arent initialized yet.

EDIT: sorry slow typer

Last edited by kostian; 02-25-2005 at 05:12 PM.
 
Old 02-25-2005, 05:16 PM   #4
ralvez
Member
 
Registered: Oct 2003
Location: Canada
Distribution: ArchLinux && Slackware 10.1
Posts: 298

Rep: Reputation: 30
OK I think I understand.
start a konsole session, then look for a hidden file called .bash_profile. If you do not find it in your home directory then it does not exit. Create it with pico (use pico .bash_profile).
If the file exist, edit it with a link to your script.
The next time you log into your system that file will run.

HOpe this helps.

Rick
 
Old 02-25-2005, 05:17 PM   #5
slackwbas
LQ Newbie
 
Registered: Feb 2005
Distribution: slackware 10.2,Fedora 4, FreeBSD 5.4,Win vista beta
Posts: 22

Original Poster
Rep: Reputation: 15
i tried to put /myshell.sh in rc.local too but the shell script is executed and didn't connect ..and its wont me to enter the system cause its takes alot of time to connect and didn't connect...its just trying many many channels to connect but its didn't work,,,
and what you mean by '&' to make the script run in the background ??
you mean add
& /path/to/myshell.sh
??
any idea?
 
Old 02-25-2005, 05:43 PM   #6
slackwbas
LQ Newbie
 
Registered: Feb 2005
Distribution: slackware 10.2,Fedora 4, FreeBSD 5.4,Win vista beta
Posts: 22

Original Poster
Rep: Reputation: 15
yes its worked ralvez..thanx alot....the script starts as will as i logged in..
but is that mean that i cant start the connection before i log in??
and is there any way else to made this script starts ..as will as any one logged in without editing bash-profile for every user
???
thanx
 
Old 02-25-2005, 07:28 PM   #7
ralvez
Member
 
Registered: Oct 2003
Location: Canada
Distribution: ArchLinux && Slackware 10.1
Posts: 298

Rep: Reputation: 30
.bash_profile is a file that is "personal" to each individual user.
In your particular case you want to activate you Internet connection, wight? Well, then what would be the point to start the connection *before* you are connected?
My apologies if I do not interpret your question correctly but given what you are trying to do seems to me the logical choice.

Rick
 
Old 02-25-2005, 08:32 PM   #8
killerbob
Member
 
Registered: Oct 2004
Location: Ottawa, ON
Distribution: Slackware
Posts: 662

Rep: Reputation: 30
He might be running servers....

In any case, since it's an internet connection script to do with actually connecting, I'd tack it on to the end of /etc/rc.d/rc.inet1 instead of rc.local. Either copy the script as it stands into rc.inet1, or reference it by calling /path/to/myscript.sh, and make certain that myscript.sh has executable permissions. I'd suggest chmod 755 for that. And you can solve any timeout issues by using the "sleep" command. Throw a "sleep 2" in after each modprobe and a "sleep 30" after the firmware call, and it'll probably fix the script for use at startup.
 
Old 02-27-2005, 05:35 AM   #9
slackwbas
LQ Newbie
 
Registered: Feb 2005
Distribution: slackware 10.2,Fedora 4, FreeBSD 5.4,Win vista beta
Posts: 22

Original Poster
Rep: Reputation: 15
hi..i tried put the script in the end of rc.inet1 and rc.inet2 but it wont work i think the network service didnt intialized yet..so is that mean that i cant start the connection before the login??
thanx
 
Old 02-27-2005, 10:26 AM   #10
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 51
Try putting this on /etc/rc.d/rc.local:
Code:
echo "Starting Speed touch connection script [by Darkflow]"
echo "Getting ready to start USB modem and mounting USB device file systems..."
modprobe ppp_generic
modprobe ppp_synctty
modprobe n_hdlc
mount none /proc/bus/usb -t usbdevfs
echo "Done"
echo "Loading Speedtouch modem Firmware (will take around 30 seconds)..."
modem_run -f /etc/ppp/microcode.dat
echo "Connecting: ADSL with pppd..."
pppd call adsl updetach &
echo "Done. You are now online."
Note the & at the end of pppd, that will make it go background (you need this because pppd will stay running until you disconnect, this is why it "hung" when you booted) and if all goes ok your system will start.
You can get the same effect if you already have a script, and you call it from rc.local with a & at the end of the line.

Last edited by gbonvehi; 02-27-2005 at 10:28 AM.
 
  


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
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
execute shell-scripts at kde startup supersucker Linux - Newbie 10 10-28-2005 10:47 AM
Execute Shell Scripts on startup dragoroberto Linux - Software 9 02-28-2005 08:46 AM
auto execute shell script ykirankumar Linux - Software 3 09-22-2004 07:23 AM
shell script how to execute x2000koh Programming 6 07-29-2003 04:20 PM


All times are GMT -5. The time now is 09:56 PM.

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