LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-03-2004, 04:07 PM   #1
perry
Member
 
Registered: Sep 2003
Location: USA & Canada
Distribution: Slackware 12.0
Posts: 978

Rep: Reputation: 30
Linux Startup - AutoExec.bat equivalent?


what is the Linux equivelant to autoexec.bat ?

i have a problem here where i'm always restarting the Internet connection by way of "service network restart" while root. it's very annoying. while i have had some help on getting the "hotspot" usb and stuff, i still have to issue a command even though no errors are reported and all the lights are on so to speak.

so i got this snr batch file written which essentially issues the sole command as mentioned. question is, is there a place i can put that during boot up (after everything else) to save me the trouble of manually running it after login ?

this should be an easy question?

and forgive my ness....

thanks

- perry
 
Old 05-03-2004, 04:10 PM   #2
dARkHunTEr
Member
 
Registered: Jul 2003
Location: The Netherlands
Distribution: Gentoo Linux
Posts: 213

Rep: Reputation: 30
try
/etc/rc.d/rc.local
(on e.g. slackware)

or the startup scripts might be in
/etc/init.d/
(on some other systems, I believe suse and others)

Last edited by dARkHunTEr; 05-03-2004 at 05:02 PM.
 
Old 05-03-2004, 04:19 PM   #3
perry
Member
 
Registered: Sep 2003
Location: USA & Canada
Distribution: Slackware 12.0
Posts: 978

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by dARkHunTEr
try
/etc/rc.d/rc.local
(on e.g. slackware)

or the startup scripts might be in
/etc/int.d/
(on some other systems, I beleive suse and others)
looks good! i'll give it whirl, let you know how i made out

- perry
 
Old 05-03-2004, 04:56 PM   #4
perry
Member
 
Registered: Sep 2003
Location: USA & Canada
Distribution: Slackware 12.0
Posts: 978

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by dARkHunTEr
try
/etc/rc.d/rc.local
(on e.g. slackware)

or the startup scripts might be in
/etc/int.d/
(on some other systems, I believe suse and others)
no such luck - it doesn't even to seem to have executed the script

here's the file in it's entirity
(my stuff is the "service network restart")
----------------------------------------
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

[ -f /etc/sysconfig/msec ] && source /etc/sysconfig/msec
[ -z "$SECURE_LEVEL" ] && SECURE_LEVEL=3

# /root/snr
df
service network restart >/home/perry/out.txt
chmod 777 /home/perry/out.txt

# Source functions
. /etc/init.d/functions

if [ -f /etc/mandrake-release -a $SECURE_LEVEL -lt 4 ]; then
R=$(cat /etc/mandrake-release)

arch=$(uname -m)
a="a"
case "_$arch" in
_a*) a="an";;
_i*) a="an";;
esac

NUMPROC=`egrep -c "^cpu[0-9]+" /proc/stat`
if [ "$NUMPROC" -gt "1" ]; then
SMP="$NUMPROC-processor "
[ "$NUMPROC" = "2" ] && \
SMP="Dual-processor "
if [ "$NUMPROC" = "8" -o "$NUMPROC" = "11" ]; then
a="an"
else
a="a"
fi
fi

# This will overwrite /etc/issue at every boot. So, make any changes you
# want to make to /etc/issue here or you will lose them when you reboot.

if [ -x /usr/bin/linux_logo ];then
/usr/bin/linux_logo -c -n -f | sed -e 's|\\|\\\\|g' > /etc/issue
echo "" >> /etc/issue
else
> /etc/issue
fi
echo "$R" >> /etc/issue
echo "Kernel $(uname -r) on $a $SMP$(uname -m) / \l" >> /etc/issue

if [ "$SECURE_LEVEL" -le 3 ];then
echo "Welcome to ${HOST}" > /etc/issue.net
echo "$R" >> /etc/issue.net
echo "Kernel $(uname -r) on $a $SMP$(uname -m)" >> /etc/issue.net
else
echo "Welcome to Mandrake Linux" > /etc/issue.net
echo "-------------------------" >> /etc/issue.net
fi
elif [ $SECURE_LEVEL -ge 4 ]; then
rm -f /etc/issue /etc/issue.net
fi

touch /var/lock/subsys/local
 
Old 05-03-2004, 05:03 PM   #5
dARkHunTEr
Member
 
Registered: Jul 2003
Location: The Netherlands
Distribution: Gentoo Linux
Posts: 213

Rep: Reputation: 30
Try placing it at the bottom of the file.
If it still doesn't work, post the output of
ls -la /etc/init.d/
 
Old 05-03-2004, 05:15 PM   #6
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
Make sure rc.local is invoked from your rc.M file in /etc/rc.d

And don't place the script your written in the rc.local file but rather save it as a script, make it executable and then put the path to the saved script in rc.local like in this format:

/usr/local/bin/<scriptname>

To make the script executable just use:

chmod +x <scriptname>

And of course if you specify what distro your doing this on, might help a little.

Last edited by trickykid; 05-03-2004 at 05:16 PM.
 
Old 05-03-2004, 11:13 PM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you go to the Mandrake Control Center -> System -> Service
make sure that the services network and internet are selected to run at boot.
 
  


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
Is there an equivalent of autoexec.bat in debian? Akhran Debian 5 09-13-2005 05:58 PM
What is the autoexec.bat and config.sys equivalent of linux lemuel Linux - Newbie 4 12-07-2004 09:34 PM
Autoexec.bat in Linux? sikandar Linux - Software 10 08-31-2003 12:30 PM
Autoexec.bat Equivalent dwpondscum Linux - Distributions 5 06-16-2003 09:51 AM
The Linux version of autoexec.bat ??? Canaris Linux - Newbie 9 05-27-2003 07:35 AM

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

All times are GMT -5. The time now is 03:09 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