This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tail log file in browser | |
# go to server.example.com:777 | |
pip install tailon | |
tailon -f /var/log/example.log -b 0:0:0:0:777 & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# check if mysql slave is running | |
log=/var/log/mysqlslave.log | |
email=user@example.com | |
date >> $log | |
res=`mysql -u root -pPassword -h db.example.com -N -B -e "show status like 'Slave_running'"|cut -f2` | |
if [ $res = 'ON' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WP "Error establishing database connection" | |
# substitute with site's index static page (when it's up, not with the error duh) | |
wget http://example.com -O [/path/to/wp]/wp-content/db-error.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# calculate mysql schemas disk size | |
mysql -h dbhost.example.com -u theuser -pThePassword -e 'select table_schema as DB, round(sum((data_length+index_length)/1024/1024),1) as MB from information_schema.tables group by table_schema order by MB desc' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see http://mysqltuner.com/ | |
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl | |
perl mysqltuner.pl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# www.fduran.com | |
date; | |
echo "uptime:" | |
uptime | |
echo "Currently connected:" | |
w | |
echo "--------------------" | |
echo "Last logins:" | |
last -a |head -3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use SSH filesystem to mount locally a remote directory through SSH | |
# www.fduran.com | |
# at local server: | |
apt-get update; apt-get install sshfs | |
mkdir /path/to/local/dir | |
# Mounting -persists on logout- (for other ssh port add: -p port): | |
sshfs remoteserver.example.com:/path/to/remote/dir /path/to/local/dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ssh without passwords, useful for unattended automatic scp/rsync-over-ssh copies etc | |
# www.fduran.com | |
# Create public key without password in origin server: | |
ssh-keygen -t dsa | |
# if ssh target port is not 22, add it (ex: -p 2020) in ssh-copy-id after 'ssh': | |
# nano /usr/bin/ssh-copy-id | |
# Upload public key to remote target server: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# munin stats http://munin-monitoring.org/ | |
# www.fduran.com | |
apt-get update; apt-get install munin munin-node | |
# Apache: add at the end of .conf file or as new sites-available: | |
# Alias /munin "/var/www/munin" | |
# you may want to password-protect the directory | |
/etc/init.d/munin-node start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# crucial files integrity check with tripwire http://sourceforge.net/projects/tripwire/ | |
# www.fduran.com | |
apt-get update | |
apt-get install tripwire (enter 2 passwords) | |
# in /etc/tripwire/twpol.txt : | |
# a) in /root section comment out all of them minus result of: | |
ls -la /root | |
# ex:: .bash_history , .bashrc , .profile |