Checking the links to your site (from affiliates) using cron and bash script.

2010-05-27 281 words 2 mins read

If you have some affiliate links and are concerned about their presence then you can setup <a class="zem_slink freebase/guid/9202a8c04000641f80000000045c9c5b" title="Cron" rel="wikipedia" href="">cron to check the links for you regularly. For this you need a very simple script (as below) and a cron entry (example further down).

#!/bin/bash –

#          FILE:

#         USAGE:  ./

#   DESCRIPTION:  Check if the links exists on affiliate sites

#       OPTIONS:  —
#          BUGS:  —
#         NOTES:  —
#        AUTHOR:  <a class="zem_slink" title="Amit Agarwal" rel="homepage" href="">Amit Agarwal (AKA),
#       COMPANY:  Individual
#       VERSION:  1.0
#       CREATED:  04/07/2010 08:19:29 AM IST
#      REVISION:  —

websites=&#8221;space seperated <a class="zem_slink freebase/en/website" title="Website" rel="wikipedia" href="">website address like;
echo &#8221;Checking the sites for Links&#8221;
echo $websites|tr &#8217; &#8217; &#8217;\n&#8217;
for i in $websites
curl -s $i |grep > <a class="zem_slink freebase/en/dev_null" title="/dev/null" rel="wikipedia" href="">/dev/null
if [ $? != 0 ]
echo &#8221;Link not found on $i&#8221;

Then make a crontab entry like this:

40 08 * *  * (echo &#8221;Subject: Link verification on affiliate sites @ `date`&#8221;;/ |/usr/sbin/sendmail <h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="">Email web statistics from the hosted website using awstats page. ( <li class="zemanta-article-ul-li"><a href="">Bing&#8217;s Wallpaper Search Feature ( <li class="zemanta-article-ul-li"><a href="">bash script with sql to get the number of records from multiple tables. ( <li class="zemanta-article-ul-li"><a href="">Variably Safe For Work Previews Questionable Links, Keeps You Out of Trouble ( <li class="zemanta-article-ul-li"><a href="">email with templates (with variables) from the command line with sendmail or any other MTA. ( <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href=""><img class="zemanta-pixie-img" src="" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">


Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it