Comments for akamaras https://www.akamaras.com Yet another blog Tue, 25 Jun 2019 05:45:05 +0000 hourly 1 https://wordpress.org/?v=5.4.10 Comment on linux script to check if a service is running and start it, if it’s stopped by Ashutosh Joshi https://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/#comment-198607 Tue, 25 Jun 2019 05:45:05 +0000 http://www.akamaras.com/?p=1541#comment-198607 In reply to makarim.

thats true …u can also check by using sh -x

]]>
Comment on linux script to check if a service is running and start it, if it’s stopped by akamaras https://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/#comment-198148 Sun, 02 Jun 2019 14:57:43 +0000 http://www.akamaras.com/?p=1541#comment-198148 In reply to AJITH.

Just make it executable

chmod +x myscript.sh

And try to set it in crontab again

]]>
Comment on linux script to check if a service is running and start it, if it’s stopped by Linux Useful Commands | Linux, DevOps & AWS https://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/#comment-197897 Thu, 23 May 2019 09:46:14 +0000 http://www.akamaras.com/?p=1541#comment-197897 […] http://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stop… […]

]]>
Comment on linux script to check if a service is running and start it, if it’s stopped by MishaHrt https://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/#comment-197852 Tue, 21 May 2019 12:27:29 +0000 http://www.akamaras.com/?p=1541#comment-197852 Hi akamaras,
I’m also a newbie. Could you help with a script that checks a service on a remote host, and starts the service on my local host if the remote host service isn’t running?

]]>
Comment on linux script to check if a service is running and start it, if it’s stopped by AJITH https://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/#comment-197848 Tue, 21 May 2019 09:34:26 +0000 http://www.akamaras.com/?p=1541#comment-197848 hello

The script does not run when the cronjob is set , but runs perfectly fine when running the script manually

Thanks
AJITH

]]>
Comment on How to block brute force attacks against wp-login.php on a Cpanel server using CSF by Mark https://www.akamaras.com/cpanel/how-to-block-brute-force-attacks-against-wp-login-php-on-a-cpanel-server-using-csf/#comment-196929 Wed, 17 Apr 2019 16:02:11 +0000 http://www.akamaras.com/?p=3006#comment-196929 Wow. what a awesome script. Well done man. Just what i was looking for and people were saying it was not possible. Server load went from 30 to 0.7 in under 2 minutes.

]]>
Comment on linux script to check if a service is running and start it, if it’s stopped by makarim https://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/#comment-196246 Tue, 26 Mar 2019 06:41:57 +0000 http://www.akamaras.com/?p=1541#comment-196246 In reply to vibhu.

This is old thread, but the problem is value of $(ps -ef | grep -v grep | grep $service | wc -l) is different beetwen terminal and bash script.

So to fix this, please assign like this:
data=$(ps -ef | grep -v grep | grep $service | wc -l)

and then, echo $data to know the real value of those.

I found, when service start value is 5, and service off value is 2.

By using if else (value>0) the return value is always TRUE..

so you can fix with new if else with real return value from bash script not from terminal.

]]>
Comment on How to send email from linux console by Makarim https://www.akamaras.com/linux/howto-send-email-from-console/#comment-196237 Tue, 26 Mar 2019 00:51:14 +0000 http://www.akamaras.com/?p=711#comment-196237 I have installed bsd-mailx, and still can’t sending email to my Gmail account.

Please let me know step by step installing bsd-mailx + configuration on ubuntu.

Thanks

]]>
Comment on linux script to check if a service is running and start it, if it’s stopped by Emelyn https://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/#comment-193199 Mon, 11 Feb 2019 07:01:11 +0000 http://www.akamaras.com/?p=1541#comment-193199 I have around 82 services like the below .to check the status and restart if its down.
Could you please help me with the code to check and restart without repeating the lines

ps -ef| grep -i “$path/eventProcessor EVP ACT” |grep -v grep
if [ $? -ne 0 ]
then
echo “process EVP ACT not running”
nohup $path/eventProcessor EVP ACT &

fi

ps -ef| grep -i ” /apps/lp/bin/eventProcessor EVP ALL” |grep -v grep
if [ $? -ne 0 ]
then
echo “process EVP ALL not running”
nohup /apps/lp/bin/eventProcessor EVP ALL &
fi

]]>
Comment on linux script to check if a service is running and start it, if it’s stopped by Ahamed Nawas Mohamed https://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/#comment-188251 Wed, 02 Jan 2019 10:50:27 +0000 http://www.akamaras.com/?p=1541#comment-188251 i want to do get like this

1. I have 7 instances and management server
2. need to restart 1 by 1 httpd service.
3. first restart 1 instance and get the status through management server. if service up and running it’s going to next server and do the same process. like this i have to do the httpd restart.
4.

]]>