Results 1 to 8 of 8
Hi everybody,
I wrote a script file like this; so i want to run this script file every time when i switch on the system...........
My question is , how ...
- 05-18-2007 #1Linux Newbie
- Join Date
- Oct 2006
- Posts
- 107
how to run the script file at start up time
Hi everybody,
I wrote a script file like this; so i want to run this script file every time when i switch on the system...........
My question is , how to run the script file at run level-6 , every time the system starts....
----------------------------------------------------------------------------------------------------------------
#!/bin/shdvanced Search
echo 'Testing MAC ADDRESSES '
if arping -c 3 172.20.80.2
then
rm -f text
touch text
arping -c 1 172.20.80.2 >> text
mac=$(awk '/^Unicast/ { gsub(/\[|\]/,"",$5);print $5}' "text")
ifconfig eth0 down
ip link set eth0 addr $mac
service network restart
rm -f text
echo ' INTERNET CONNECTION IS ESTABLISHED SUCCESSFULLY'
exit 1
else
echo ' NOT established'
---------------------------------------------------------------------------------------------------------------------------
Thanks in Advance
- 05-18-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Make a symbolic link of your script in /etc/rc6.d.
The name of the link must start with an uppercase S followed by an unique 2 digit sequence number.
Check the names of the other scripts in the directory. The scripts are executing in order if these numbers.
Regards
- 05-19-2007 #3Linux Newbie
- Join Date
- Oct 2006
- Posts
- 107
doubt on script
Hello ,
I tried as well as u said , but it is showing like
"/etc/rc6.d" is not modifiable, when iam trying to enter the entry in the corresponding file.
Pls help me.....
- 05-19-2007 #4Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
You must have root permission to make the link.
Log in as root and type:
ln -s /yourdir/yourscript_name /etc/rc6.d/S95yourscript_name
Regards
- 05-20-2007 #5Linux Newbie
- Join Date
- Oct 2006
- Posts
- 107
script
Hello sir,
I did as u said only, but still it is not working,
when iam checking with "chkconfig --list Scriptname" , it is showing error reading information.
And also, it is notshowing the script name when i issue the comand "chkconfig --list"
Regards
mallik
- 05-20-2007 #6
Runlevel 6 means you are rebooting the system, so no services will run. Since thats just a script, I would put the contents in /etc/rc.d/rc.local or /etc/init.d/boot.local depending on the distro.
- 05-20-2007 #7Linux Newbie
- Join Date
- Oct 2006
- Posts
- 107
script
Hi,
I entered my script in the run level 5 only,
when i check with chkconfig --list script_name, it is not showing the staus of the script
- 05-20-2007 #8
Ordinary scripts don't work with chkconfig thats why I suggested you put the contents of your script in /etc/rc.d/rc.local or /etc/init.d/boot.local. If you want your srcipt to work with chkconfig, then take a look at some of the scripts in /etc/init.d and adjust your script to their format.


Reply With Quote