469,362 Members | 2,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

Crontabs for automatic site updates.

Crontabs for automatic site updates.

Does anyone know how to set up a crontab for automatically updating
a webpage on a regular basis. We know how to set these to run perl
files, but seem to have an issue as far as comming up with the command
to copy one html file to replace another. Any help or simple scripts
to do this will be greatly appreaciated.

--
The List Man
http://www.esotericwonders.com
Aug 2 '05 #1
2 2998
The List Man wrote:
Crontabs for automatic site updates.

Does anyone know how to set up a crontab for automatically updating
a webpage on a regular basis. We know how to set these to run perl
files, but seem to have an issue as far as comming up with the command
to copy one html file to replace another. Any help or simple scripts
to do this will be greatly appreaciated.


1) Determine how to update the html files from the command line.
2) Use crontab to execute that command.

00 00 * * * perl fixup.pl; rsync -av public_html user@webhost:

Note that this is not really a perl question, and that postings
should be made to comp.lang.perl.misc (not comp.lang.perl).
-Joe
Aug 2 '05 #2
On 2005-08-02 21:15:11 +0200, The List Man
<li********@esotericwonders.com> said:
Crontabs for automatic site updates.

Does anyone know how to set up a crontab for automatically updating
a webpage on a regular basis. We know how to set these to run perl
files, but seem to have an issue as far as comming up with the command
to copy one html file to replace another. Any help or simple scripts
to do this will be greatly appreaciated.


Shell commands between ``s will be executed. So you can do:
`cp $source $destination`
If you want to keep the output (so you can check if something went wrong):
$output = `cp $source $destination`

For example, if you want to copy index.html to index.7.17.2005.html,
and then copy a new file to index.html (with the dates changing
everyday):

#!/usr/bin/env perl

# get the date
($s, $m, $h, $d, $M, $y, $wd, $doy, $dst) = localtime(time);
$y += 1900;
$d--;
$yesterday = "$M.$d.$y"; // yesterday's date m.d.y

# paths
$path_to_website = "/var/www/html";
$path_to_new_file = "/home/myself/website/index.html";

# copying
`cp ${path_to_website}/index.html ${path_to_website}/index.$yesterday.html`;
`cp ${path_to_new_file} ${path_to_website}/index.html`;

Aug 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Gert van der Kooij | last post: by
1 post views Thread by Michel Esber | last post: by
1 post views Thread by rdemyan via AccessMonster.com | last post: by
1 post views Thread by Ibrahim. | last post: by
reply views Thread by =?Utf-8?B?VG9kZA==?= | last post: by
4 posts views Thread by =?Utf-8?B?Zmx5ZXJk?= | last post: by
1 post views Thread by =?Utf-8?B?LUdFUC4=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.