#!/bin/bash # test1.txt should contain a list of IP's to be tested for i in `cat test1.txt`; do ping -c 1 -W 1 $i &> /dev/null if [ $? -ne 0 ]; then #use if [ $? -eq 0 ]; then to test the up IP's echo "$i is down" fi done
Monday, October 2, 2017
Simple shell script to check if a Host is UP
If you work on multiple servers and want to check what hosts are
up/down then you can use the below shell script to test multiple
servers connectivity ::
Etiquetas:
How-To
Roundcube : failed to open log file /var/log/httpd/suexec_log
While working on a issue for one of the client, I found that the Webmail
link was giving 500 internal server error for Roundcube and checking
the apache error logs I was getting the below errors.
So, I’ve copied that file from one of my other server and restarted apache service and this fixed the issue with 500 internal error for roundcube.
Note :: The cgi_wrapper file should have 755 permission with ownership of root
Further checking , I’ve found that the below file was missing :failed to open log file /var/log/httpd/suexec_log fopen: Permission denied [Mon Aug 18 16:50:08 2014] [warn] [client x.x.x.x] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server [Mon Aug 18 16:50:08 2014] [error] [client x.x.x.x] Premature end of script headers: index.php
/var/www/cgi-bin/cgi_wrapper/cgi_wrapper
So, I’ve copied that file from one of my other server and restarted apache service and this fixed the issue with 500 internal error for roundcube.
Note :: The cgi_wrapper file should have 755 permission with ownership of root
Setup Putty Window Title Permanently
I was working on a migration of servers and for that I was manually
setting up the Window Title for each server in putty but the changes
last only till I press Enter on keyboard.
It’s often gets difficult to memorize the putty session, if a proper title is not set and hence I was looking for a solution to setup a permanent windows title for a server in putty and found that the same can be achieved by modifying/updating the below two settings in Putty:
It’s often gets difficult to memorize the putty session, if a proper title is not set and hence I was looking for a solution to setup a permanent windows title for a server in putty and found that the same can be achieved by modifying/updating the below two settings in Putty:
- In Window -> Behavior set your desired Window Title
- In Terminal -> Features check
Disable remote-controlled window title changing
Backup Single Table from a database using MySQLdump
We normally backup entire database using mysqldump utility but what
if only one table gets corrupt and you only want to restore that
table from backup.
In that case you can use the below simple steps to backup and restore a single mysql table using mysqldump utility.
Backup:
Restoration :
In that case you can use the below simple steps to backup and restore a single mysql table using mysqldump utility.
Backup:
example :mysqldump -u -p databasename tablename > tablename.sql
mysqldump psa BackupsScheduled > BackupsScheduled.sql -u admin -p`cat /etc/psa/.psa.shadow`
Restoration :
for example :mysql -u -p databasename < tablename.sql
mysql psa < BackupsScheduled.sql -u admin -p`cat /etc/psa/.psa.shadow`
List all cPanel users having Wildcard Remote Mysql Access
Remote MySQL option in cPanel allows other webservers to access the MySQL database on your server remotely.
Remote MySQL option can be very handy, if you want to allow applications like shopping carts or guestbooks on your other servers to access the databases.
But on the contrary, if the Remote MySQL option is not handled with care then it can lead to database hacks.
So, If you want to find out all cPanel users having Wildcard Access enabled then you can use the below simple command :
Remote MySQL option can be very handy, if you want to allow applications like shopping carts or guestbooks on your other servers to access the databases.
But on the contrary, if the Remote MySQL option is not handled with care then it can lead to database hacks.
So, If you want to find out all cPanel users having Wildcard Access enabled then you can use the below simple command :
root@server[#]mysql -N mysql -e "Select User from user where Host='%'" | awk -F _ '{print $1}' | uniq
Subscribe to:
Posts (Atom)