Submit your Sitemap with a Script

submit-sitemap-to-search-engines

This shell script will submit your sitemap files to google and bing search engines on a regular basis simply edit the urls you wish to submit and setup a cronjob to submit daily or weekly as required. For more information visit clusterednetworks.com



Usage:

  1. Pull up a terminal or SSH into the target server.

  2. Logon as root

sudo -i

  1. Download the script.

wget https://raw.githubusercontent.com/clusterednetworks/submit_sitemap_to_search_engines.sh

  1. Edit the url to your sitemap you wish to submit to google to match your environment.

    wget -O- https://www.google.com/webmasters/tools/ping?sitemap=https://www.clusterednetworks.com/sitemap.xml
    
  2. BING requires you to encode the url you submit to them using a URL encoding tool (see https://meyerweb.com/eric/tools/dencoder/ ) you will have to use the encoder to obtain the proper URL you submit to BING. In my case it was as follows

    wget -O- https://www.bing.com/ping?sitemap=https%3A%2F%2Fwww.clusterednetworks.com%2Fsitemap.xml
    
  3. Save the file

  4. Make the script executable

chmod +x submit_sitemap_to_search_engines.sh

  1. Run the script.

./submit_sitemap_to_search_engines.sh

  1. Setup a cronjob to run the script daily/weekly if you choose.
    1 1   * * * /etc/submit_sitemap_to_search_engines.sh >/dev/null 2>&1
    

Posted in Linux Desktop Tips, Linux Network Admin Tips, Marketing on Feb 12, 2021