Monthly Archives: July 2013

What happen to Newegg?

I recently bought a bad drive from them. Sent it back and now very angry because Newegg said there is a scratch on it?!?! I shipped it back to them with care and it was well packaged.

Their lack of customer service reminded me why I stop shopping with them and moved to Amazon. I only forgot because they cleverly sold me a lemon.

Be careful of Newegg, and there “please send it to the manufacture” scam. I doesn’t matter if you bought it and sent it back immediately. It doesn’t matter if the product has a high failure rate. I took the risk because the product (a WD HD) was bundled with a NAS I wanted.

Anyways, my credit card company helped me get my money back. Boo to you Newegg.

Working with Cron Jobs

For a while now, I have been using my shared hosting to backup/store numerous image files. Retrieving those files over the internet has always been a pain. Especially when there are hundreds of files in a given folder. The end goal is to be able to download the archived folder to my computer for easy viewing.

So, I took the time to code something up. Here’s the psuedo code:

  1. zip folder
  2. rename zip to include date stamp
  3. move zip to another destination
  4. delete contents of folder for future backups
  5. give myself a high five

Of course, I Google’d and looked for an easy way out… to see if some has posted the exact code I was looking for. No such luck but here are the links that were handy:

What I learned:

  • Cron Jobs on shared web hosting gives us the ability to run automated shell level scripts.
  • Cron Jobs coding was essentially Unix, nice I can code Unix!

Once I got started, I did run into a few Cron Jobs specifics:

  1. you have to escape the ‘%’ sign with a ‘\’ in a cron job,
  2. bonus: && operator, helped me reduce my script to one line,

Nevertheless, here’s the script that will hopefully help someone else looking to compress and backup a whole directory then delete its contents:

zip /destination/of/directory/with/date/label/$(date +\%Y\%m\%d).zip /directory/to/be/zipped/* && rm /directory/to/be/zipped/cleared/*

Happy Coding!