HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

how to run script

 
arupdas
Occasional Advisor

how to run script

1. Is there any table or location where the present routing table(netstat -nr) or information has been stored.
3. I am non root user so no root priviledge with my account. I want to run a script at system startup. So, is it possible to run the script ?
7 REPLIES
Torsten.
Acclaimed Contributor

Re: how to run script

1) The routing table is usually stored in the kernel on most operating systems.

3) You can ask root for this. You can also add an entry in your profile to execute a script when you log on.


where is 2) ?

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
arupdas
Occasional Advisor

Re: how to run script

1. Mention the path !!
2. If i logging the system many times it will start many instances of that script. This is the reason for not using profile to run script.

If there any way please describe step by step.

Mel Burslan
Honored Contributor

Re: how to run script

by means of the question, if you mean where the static routes are configured at the startup time, the formal answer is, "in /etc/rc.config.d/netconf file", but this may not be it. I have seen some poorly written applications, which put a "route add..." command, into their startup scripts, which is as effective as the formal method, but I highle frown upon this, when it is time to troubleshoot something related to networking, such as a firewall change or similar. If you are looking for the currently running network configuration and related routing tables, "netstat -rn" or "netstat -rnv" (latter gives you the netmasks for the network routes) is the only way to obtain it.

3. If you do not have root privilege, you can not modify the startup scripts. Otherwise unix would be the best platform to attack for script kiddies. Ask your sysadmin to put up a script to startup an application at the system boot time, if it is legitimate. Otherwise if you are trying to slip one without anyone noticing, giving you some sort of advantage, shame on you :)
________________________________
UNIX because I majored in cryptology...
Mel Burslan
Honored Contributor

Re: how to run script

Answer to your Q3
in your .profile, you insert a block like this

...
MYSCRIPT=
ps -ef | grep -q "$MYSCRIPT"; r=${?}
if [ ${r} -ne 0 ]
then
nohup
&
else
echo "${MYSCRIPT} is already running"
fi
....

this will launch your script if it is not running somewhere in the memory, and if it is running, it will not start a second instance but just give you the message it is already running.

hope this helps
________________________________
UNIX because I majored in cryptology...
TTr
Honored Contributor

Re: how to run script

> I am non root user
If you are not a root user, what are you doing working on network routes?

> netstat -nr

/usr/bin/netstat has -r-xr-sr-x permissions. Why can you not run it as a regualr user?
If someone changed the permissions, you can ask to change them back or you can ask your root to install sudo and allow you to run the command when you need it.
arupdas
Occasional Advisor

Re: how to run script

You take this query as a gathering information not for problem .
For monitoring netstat -nr is working i know....
TTr
Honored Contributor

Re: how to run script