Skip to content

Instantly share code, notes, and snippets.

View fduran's full-sized avatar

Fernando Duran fduran

View GitHub Profile
@fduran
fduran / gist:4622779
Created January 24, 2013 15:09
MySQL Master-Slave Replication
# www.fduran.com
MySQL Master-Slave Replication Notes
Master
/etc/mysql/my.cnf
server-id = 100
log_bin = /var/log/mysql/mysql-bin.log
binlog-do-db = wpdb
binlog-ignore-db = mysql
# www.fduran.com
# delete files in a folder older than a number of days (100 for example)
find /path/to/folder -mtime +100 -exec rm -f {} \;
// www.fduran.com
// send mail with Amazon AWS SES without extra library
// needs Pear: apt-get install php-pear
<?php
function mailSES($to, $subject, $body, $from)
{
include_once('Mail.php');
$headers["From"] = $from;
$headers["To"] = $to;
# www.fduran.com
# renice many processes with the same name
for i in `pgrep processname`; do renice 20 -p $i; done
# www.fduran.com
# test cronjobs
# cron running?
pgrep cron
service cron status
# or crond for redhat, other distros above
# add line in crontab:
*/1 * * * * root /bin/date >> /tmp/cronlog
# www.fduran.com
# sync (copy) local to remote server directory
# take out dry-run after test
rsync --dry-run -azvrh -e 'ssh -p 2022' --exclude 'donotcopy' /var/www/ [email protected]:/var/www/
# options:
a: archive, preserve metadata
z: compression
v: verbose
# www.fduran.com
# check ssl connection
echo '' |openssl s_client -ssl3 -connect google.com:443 -CApath /usr/share/ssl-cert
# www.fduran.com
# Run script detached from an SSH terminal
nohup script.sh </dev/null &
# Postfix mail review
# look at logs
tail /var/log/mail.log
tail /var/log/mail.err
# view queue
mailq
# delete deferred messages in queue
postsuper -d ALL deferred
# www.fduran.com
# set up Celery with Django (dev queuing)
(source activate)
# install (kombu is included)
pip install celery
pip install django-celery