Hey everyone
can you check this script logic ?
it has to restart webservice if found server load is higher than X,
also i have put it in crontab to run every one minute
Some comment:
I would stay away from that SIGNAL -9, at least I would find out what could be the side-effects of it.
If httpd is not running because you kill it, service httpd start should be the more appropriated command. Speaking of appropriated, service httpd stop would be a better choice than pkill -9 httpd
It is best to use absolute paths in a cronjob. e.g./sbin/service httpd start
Interesting you are using a variable named loadavg. The Linux kernel keeps a realtime record of that average load in /proc/loadavg. Reading from that would be cleaner that using uptime.
Let's use awk to handle the floating point as well.
The return of awk can be use to follow with a flow control branch
the output of awk is always 1
awk '{print ($1>10? 1 : 0)}' /proc/loadavg
but loadavg is useful in this case at it show the right load,
can you check the result of your line? coz i get 1 in all time
Some comment:
I would stay away from that SIGNAL -9, at least I would find out what could be the side-effects of it.
If httpd is not running because you kill it, service httpd start should be the more appropriated command. Speaking of appropriated, service httpd stop would be a better choice than pkill -9 httpd
It is best to use absolute paths in a cronjob. e.g./sbin/service httpd start
Interesting you are using a variable named loadavg. The Linux kernel keeps a realtime record of that average load in /proc/loadavg. Reading from that would be cleaner that using uptime.
Let's use awk to handle the floating point as well.
The return of awk can be use to follow with a flow control branch
Or set an exit code in awk that can be directly used in the shell's if clause:
I use the 5 minutes average ($2=2nd value), and this should be run every 5..10 minutes.
Last edited by MadeInGermany; 11-04-2014 at 03:07 PM..
Or set an exit code in awk that can be directly used in the shell's if clause:
I use the 5 minutes average ($2=2nd value), and this should be run every 5..10 minutes.
load average is now 20 , but still output of this script is OKAY
which should be execute service ....
Hi,
Im going to use shell script for load the data into DB.
First i need to read the trail file(csv file has two columns with comma separated ) like file name trail1024(last 4 digitsMMDD).
In this trail file 27 entries will have like below,I need to read first csv file name and get the 4... (1 Reply)
Hello, on my hostserver i see one VPS of mine got load of 200.00 and netstat nothing (not a single blank line on netstat command) after some time, netstat started showing connections, but i see no excessive IP connections.
tail -f /var/log/httpd/access_log shows no activity
/var/log/messages ;... (1 Reply)
I would like to write a script to do such thing , if a directory have file that the extension is today (yymmdd), then do a specific action , I will run a cron job to run this script .
For example
Today is 2nd , if the directory have files which file name are abc.121102 and def.121102 ,... (6 Replies)
Hi All,
I want to check load balance(or CPU utilzation) on server dynamically based on that value i want to perform some operation .
Means if load balance is <10 then start server .
Am using prstat -a 1
commadn it is listing CPU utilzation/load balancing dynamically ..
How to take this... (7 Replies)
Hi All,
I wanted to know what time the box jobs were loaded into a particular Autosys Instance.
Is there a autosys command to find out the above? (The timestamp at which a box was loaded)
I had loaded my JIL script without outputting it to the log file. (4 Replies)
in /etc/init.d/networking of an ubuntu computer, I found this code:
if ifdown -a --exclude=lo; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
Shouldn't it be replace by
ifdown -a --exclude=lo
... (0 Replies)
hi all
need your help.
I am wrting a script that will load data into the table.
then on another load will append the data into the existing table.
Regards
Ankit (1 Reply)
Hi..
When i refered the script /etc/rc.sysinit...
i found the "action commands" like
But this is not working in my shells..
the following error is coming...
Please anybody help
Thanks in advance
esham (5 Replies)