Technology Blog

Author Archive

Magento Order emails not being sent out, but others are

by on Jun.02, 2015, under Magento, Web Development

So we had a customer call in today saying that order notification emails for their site were not going out.  They run on Magento 1.9.1 which has implemented a new email queue system for magento.  They receive about 100-1,000 orders a day, which can mean several thousand emails, since each order gets several emails post order (order confirmation, order update, order shipping/tracking number, follow up email).

So the first thing I did was place a test order on production.  I did not receive the email.  I looked in the /var/log/messages for the server and searched for my email address.  It was not in there.  I did notice other email’s in there, including the account creation email, which I almost dismissed to the client as the order email.  This email is not queued like the order emails so it immediately gets sent out.

So this was a bit scary, not seeing the email in the system /var/log/messages then I remembered about the queuing Magento has, and that it runs from cron.  I looked for a locked up cron by doing ps aux |grep cron but nothing came up.  It looked like no cron was locked.  I then remembered the client had AOE Scheduler installed.  I browsed to system->scheduler->list view.

In the table we had to select core_email_queue_send_all and click on the search button.  This limits the table view to this value.  I had something like 28 results found, but my view filter was set to show 25 at a time.  So I could not see the trouble 3 at the end.  I switched to show the view at 50 which showed me all of my results and I noticed the last item was a “RUNNING” process from several days ago.  There were a few “MISSED” processes before it.

I then selected the RUNNING row and selected “kill” from the actions window.  It then said it would kill on the next cron run.  This meant that I had to wait two minutes to check back.  I checked back and it was still there.  I then selected the row and clicked on “delete” from the action drop down and this immediately removed the row.  I waited two minutes and refreshed the page and it was now running.  I also started noticing through mailgun that the emails were sending but I didn’t get mine.  This is because the most emails magento will process in one cron is 100.  This means if you have 3,000 in queue, it will take 30 minutes to get them all out.

 

You may also need to do this with newsletter_send_all.

Leave a Comment more...

Git – Revert Commit Already Pushed to a Remote Repository

by on May.14, 2015, under Uncategorized

Delete the last commit

Deleting the last commit is the easiest case. Let’s say we have a remote mathnet with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the mathnet remote repository to the parent of dd61ab32:

$ git push mathnet +dd61ab32^:master
Where git interprets x^ as the parent of x and + as a forced non-fastforward push. If you have the master branch checked out locally, you can also do it in two simpler steps: First reset the branch to the parent of the current commit, then force-push it to the remote.

$ git reset HEAD^ --hard
$ git push mathnet -f

 

Originally taken from Christoph Copied here for reference.

 

For NYC Web Design check out the link.

Leave a Comment more...

check_mk qmail-stat not working with plesk

by on Jan.26, 2015, under Linux, Plesk

I saw the check_mk added the ability to monitor the qmail mail queue, so I wanted to get that setup on a few plesk servers. The auto inventory wasn’t seeing the qmail and therefore wasn’t adding the check. It turns out that two things were wrong:

  • I updated the check_mk agent on the plesk server, but didn’t update the check_mk software on the nagios host. I needed to install the latest version in BOTH places to get it working.
  • Plesk uses its own paths, so we had to symlink /var/qmail/bin/qmail-qstat to /bin/qmail-qstat

ln -s /var/qmail/bin/qmail-qstat /bin/qmail-qstat

I spent way too much time figuring that out. Hopefully this post will help the next poor soul!

Leave a Comment more...

Find Databases created outside of Plesk

by on Sep.10, 2014, under MySQL, Plesk

So today I needed a quick script to list all of the mysql databases on the system and compare that to the databases that were created inside of plesk. I wanted to print any databases that were created outside of plesk.

Why you might ask? It came to my attention that some of our system admins were creating databases manually through command line and setting up users that way when doing code deployments onto our shared plesk servers.

Whats wrong with that? Well if the database is outside of plesk, then plesk backup system, and plesk migration manager won’t know about the databases, nor the db users/passwords. This means if you are relying on plesk backup xml, or plesk migration manager for your server upgrades or disaster recovery, you’re going to have an issue with missing databases at some point!

The code is simple and is below. From memory it should work on plesk 8-11 and I have tested it on v10/11 myself.

Next to add to the list, is to set this up as a cron and email our general support queue if a new db is created outside of the plesk system.

To install / run, copy the below into a file called db_checker.php, then at a command line run “php db_checker.php”. You will need to be the root user to run this script.

Leave a Comment more...

Shell Script to Optimize all tables for a database

by on Feb.16, 2012, under Linux, MySQL

This shell script finds all the tables for a database and run a command against it.

 

See File optimize-tables

The file’s contents are below as well:

#!/bin/sh

# this shell script finds all the tables for a database and run a command against it
# @usage "mysql_tables.sh --optimize MyDatabaseABC"
# @date 6/14/2006
# @version 1.1 - 1/28/2007 - add repair
# @version 1.0 - 6/14/2006 - first release
# @author Son Nguyen

DBNAME=$2

printUsage() {
  echo "Usage: $0"
  echo " --optimize <dbname>"
  echo " --repair <dbname>"
  return
}


doAllTables() {
  # get the table names
  TABLENAMES=`mysql -D $DBNAME -e "SHOW TABLES\G;"|grep 'Tables_in_'|sed -n 's/.*Tables_in_.*: \([_0-9A-Za-z]*\).*/\1/p'`

  # loop through the tables and optimize them
  for TABLENAME in $TABLENAMES
  do
    mysql -D $DBNAME -e "$DBCMD TABLE $TABLENAME;"
  done
}

if [ $# -eq 0 ] ; then
  printUsage
  exit 1
fi

case $1 in
  --optimize) DBCMD=OPTIMIZE; doAllTables;;
  --repair) DBCMD=REPAIR; doAllTables;;
  --help) printUsage; exit 1;;
  *) printUsage; exit 1;;
esac

Leave a Comment more...

Convert any dedicated machine into a xen hypervisor

by on Feb.16, 2012, under Linux

 

Important Note:

Since these were Rackspace servers – the default repository that they connect to does not have the xen kernel packages and xen software on them.  We had to call and have Rackspace add the capability of using certain commands like “yum install xen”

Step 1.1:Install the xen kernel and xen.

 


# yum --disableexcludes=all install kernel-xen xen

 

Step 1.2: Reboot

 

# reboot

 

 

Step 1.3:Ensure the new kernel loaded.  You should see xen after the kernel version:

 

# uname –a

 

Linux web1.myhostname.com 2.6.18-238.9.1.el5xen #1 SMP Fri Mar 18 12:53:42 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

 

 

Step 1.4:Ensure xen is running on boot.

 

# xm list

Name                                      ID Mem(MiB) VCPUs State   Time(s)

Domain-0                                   0     7989     8 r-----   6268.9

 

Congrats the host machine is setup!

Step 2: Let’s setup a CentOS virtual machine.  Virt-install:

 

# virt-install -–prompt

 

What is the name of your virtual machine? mnode1

How much RAM should be allocated (in megabytes)? 8024

What would you like to use as the disk (file path)? /home/xen/mnode1

How large would you like the disk (/home/xen/mnode1) to be (in gigabytes)? 100

What is the install URL? http://mirror.cogentco.com/pub/linux/centos/5.6/os/x86_64/

&nbsp;

<code>Starting install...</code>

Retrieving file .treeinfo...                             |  417 B     00:00

Retrieving file vmlinuz...                               | 2.1 MB     00:01

Retrieving file initrd.img...                            | 7.9 MB     00:03

Creating storage file...                                 | 100 GB     00:00

Creating domain...                                       |    0 B     00:05

error: Failed to get local hostname

Domain installation still in progress. You can reconnect to

the console to complete the installation process.

 

Step 4:At this point you need to connect to the virtual machines “console” to continue.

# xm console <hostname>

Step 5:Go through the centos install…..I’ll omit this process.  But in short you WILL need to know the ip address, subnet, and gateway of your server.

 

 

Leave a Comment more...

Install APF Firewall

by on Feb.16, 2012, under Linux, Security

Install iptables (Hopefully, you’ve done this already)

# yum install iptables* -y

Download, unpack, install of APF from source:

 

# cd /usr/local/src

# wget http://www.rfxn.com/downloads/apf-current.tar.gz

# tar -zxf apf-current.tar.gz

# cd apf-9*

# ./install.sh

 

Cleanup source install files:

# rm -Rf /usr/local/src/apf-9* && cd

 

Backup original APF config:

# cp /etc/apf/conf.apf /etc/apf/conf.apf.bak

 

Edit APF Configuration file:

# nano -w /etc/apf/conf.apf

 

Change the following settings:

RAB="0" to RAB="1"

RAB_PSCAN_LEVEL=”2″ to RAB_PSCAN_LEVEL=”3″

TCR_PASS=”1″ to TCR_PASS=”0″

DLIST_PHP=”0″ to DLIST_PHP=”1″

DLIST_SPAMHAUS=”0″ to DLIST_SPAMHAUS=”1″

DLIST_DSHIELD=”0″ to DLIST_DSHIELD=”1″

DLIST_RESERVED=”0″ to DLIST_RESERVED=”1″

IG_TCP_CPORTS=”21,22,25,53,80,443,3306″

IG_UDP_CPORTS=”″

EGF=”1”

EG_TCP_CPORTS=”22,3306,80,443″

EG_UDP_CPORTS=”″

DEVEL_MODE=”0”

 

Step 20: Reload APF:

# /usr/local/sbin/apf–r

Step 21:Make sure APF starts automatically after reboot:

# chkconfig --add apf

# chkconfig –level 345 apf on

Leave a Comment more...

Twitter Updates for 2011-11-19

by on Nov.19, 2011, under Uncategorized

Leave a Comment more...

Twitter Updates for 2011-10-13

by on Oct.13, 2011, under Uncategorized

  • @LiquidWeb its the host that's been down for 7 hours now: dc2-vps1-245 #
Leave a Comment more...

Twitter Updates for 2011-10-12

by on Oct.12, 2011, under Uncategorized

  • @liquidweb Not experiencing the Heroic Support today…down since 6:30am EST and no one can give me an ETA or description of whats going on. #
Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...