Jump to content
mdedens

Command Line For Google Sitemap

Recommended Posts

Hi

 

Google released a SiteMap Generator built in Python. But they don't say how to connect to your server to run the script. I uploaded it to my public html folder. But I have no idea how to connect to the server via Command Line to execute the script. Any ideas how to do this?

 

Here's a link to the Google page:

 

google.com/webmasters/sitemaps/docs/en/sitemap-generator.html

 

-Mike

Share this post


Link to post
Share on other sites

"Connecting to the server via command line" is what's known as a shell, and shell access is not allowed on TCH servers.

 

You'd need to follow the next suggestion ("Setting up a recurring script") by setting up the script to run as a cron job.

Share this post


Link to post
Share on other sites

Sorry, had 1 more question. I think I get how to setup a cron job in the cpanel. But is there a special directory I need to put the Python script in? Like python or cron dir? Or just my public html folder?

 

Thanks for any advice.

 

 

Mike

 

Edit

 

Here is the command I am supposed to run, if it helps. And I think I'm supposed to replace "path" with the root path to config.xml

 

$ python sitemap_gen.py --config=/path/config.xml

Edited by mdedens

Share this post


Link to post
Share on other sites

I don't believe it matters what directory you put the python script in. You could put in your /public_html directory, or even a subdirectory of /public_html.

 

Here is the command I am supposed to run, if it helps. And I think I'm supposed to replace "path" with the root path to config.xml

 

>$ python sitemap_gen.py --config=/path/config.xml

Yes, you need to use an absolute file path to the config.xml file, as well as to the sitemap_gen.py file. Your cron command should look something like this:

>python /home/cpanelName/public_html/sitemap_gen.py --config=/home/cpanelName/public_html/config.xml

...assuming config.xml and sitemap_gen.py are in your /public_html directory. Replace 'cpanelName' with your actual CPanel username.

 

Hope this helps...

Share this post


Link to post
Share on other sites

Ah, nevermind... (my topic was merged)... and I should have noticed the earlier query and responses. Thanks, David, for the informative replies!

Share this post


Link to post
Share on other sites

I'm sorry, but I am a little bit less savvy with programming. How can I set up a cron job in CPanel?

Share this post


Link to post
Share on other sites

Ah, nevermind. Setting up a cron job through cPanel is the easiest thing. It's late and the A/C in my office is broken... Thanks for reading.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×