Documentation

Light-weight, fast, simple and powerful!
 
Translations of this page?:

Wolf CMS administration guide

Welcome to the Wolf CMS administration guide. This book is a collection of wiki pages from the wolfcms.org documentation wiki that are gathered together to form a book-like total.

By accessing this book and selecting the “Export to ODT” button, you can generate an Open Office document for your viewing/printing pleasure. You can of course also use Open Office to turn the ODT document into a PDF file.

This information has been migrated to http://docs.wolfcms.org/

This information has been migrated to http://docs.wolfcms.org/

Enabling cron jobs

Available from Wolf CMS release: 0.6.0 (optional)

Cron is a daemon that executes commands at specified intervals. These commands are called “cron jobs.” Cron is available on Unix, Linux and Mac servers. Windows servers use a Scheduled Task to execute commands.

Wolf CMS itself does not require cron, but cron.php provides a cron_run event that can be used by plugins.

The cron command

In the following example, the crontab command shown below will activate the cron tasks automatically on the hour:

0 * * * * wget -O - -q -t 1 http://www.example.com/wolf/app/cron.php

The above sample assumes you've installed Wolf CMS to the root of your site.

In the above sample, the 0 * * * * represents when the task should happen. The first figure represents minutes – in this case, on the “zero” minute, or top of the hour. (If the number were, say, 10, then the action would take place at 10 minutes past the hour.) The other figures represent, respectively, hour, day, month and day of the week. A * is a wildcard, meaning “every time.”

The rest of the line basically tells the server to “ping” the url http://www.example.com/wolf/app/cron.php.

Here is a diagram of the general crontab syntax, for illustration:

# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 7) (Sunday=0 or 7)
# | | | | |
* * * * * command to be executed

Thus, the cron command example above means “ping http://www.example.com/wolf/app/cron.php at the zero minute on every hour of every day of every month of every day of the week.”

How to set up a cron job

Cron jobs are scheduled by setting up a “crontab.” A crontab is a text file that contains the commands to be run. This file can be created and edited either through the command line interface, or, if you manage your website through a web-based control panel such as cpanel or Plesk, you will use the web interface. Check with your hosting company for detailed instructions if you are using a web-based control panel.

To edit a crontab through the command line, type:

crontab -e

If this fails, see the Troubleshooting Cron Jobs section below.

Add ONE of the following lines:

45 * * * *  /usr/bin/lynx -source http://example.com/wolf/app/cron.php
45 * * * * /usr/bin/wget -O - -q -t 1 http://www.example.com/wolf/app/cron.php
45 * * * * curl --silent --compressed http://example.com/wolf/app/cron.php

This would have a lynx, wget, or curl visit your cron page 45 minutes after every hour.

Three options are provided in case either wget, lynx or curl are not installed on the server. Any will do the job well.

Learn more about the crontab file syntax here to set up the cron job to run more or less often.

There are many ways to configure a cron job. If you have full access to crontab features, you should be able to simply paste in one of the above example commands – be sure to replace “example.com” with your own web domain or docroot.

If you're on shared hosting, you should be able to find cron job configuration somewhere in your hosting control panel. Some hosts even have cron “wizards” that walk you through the cron configuration, making it much easier if cron is new to you. On a Windows system you can accomplish the same thing with scheduled tasks to launch Internet Explorer pointed to the URL.

Some hosting companies don’t allow access to cron

If your hosting company restricts access to cron you have many options.

  • Ask the company to give you access, or to set up a cron job for you
  • Ask someone else with access to a server to set up a cron job for you. Any Unix, Linux, or Mac server with access to the internet can have a cron job to regularly visit your site. There are also some companies that offer cron services.
  • Use the Poor Man's Cron option.

Cron doesn't guarantee your commands will run at the specified interval. But Wolf CMS will try its best to come as close as possible. The more you visit cron.php, the more accurate cron will be.

Poor Man's Cron

Since not everyone has access to cron or Scheduled Tasks on their system, we’ve also added “poormans cron” support. This allows a cron job to be started at certain intervals and works on the basis of visits you get to your site.

To use poormans cron, edit config.php and set:

define('USE_POORMANSCRON', true);
define('POORMANSCRON_INTERVAL', 3600);

This will enable the poorman's cron support and set the run interval to once every hour.

Please note that this works based on the visits to your site. This means if you have few visitors, the mechanism will be increasingly inaccurate. With more visitors, it will be more accurate. A normal cron job or sheduled task should always be preferred to the poorman's cron option!

Troubleshooting cron jobs

If you receive a permission denied error after starting crontab -e, you may need to use sudo:

sudo crontab -e

You may need to adjust the path to wget, lynx or curl in your crontab. For example, the cron example listed above contains the line:

45 * * * *  /usr/bin/lynx -source http://example.com/wolf/app/cron.php

However, Lynx may be in a different location on your server, or not installed at all. To find out where Lynx is installed, enter:

whereis lynx

or

which lynx

If it is not located at /usr/bin/lynx, adjust the path as needed. The same applies for wget and curl. If none are installed ask a server administrator for help.

It may be necessary to change http://example.com/wolf/app/cron.php to the location of your Wolf CMS installation. For example, if you have Wolf CMS installed in a subdirectory, for example “wolfcms”, it will be http://www.example.com/wolfcms/wolf/app/cron.php).

Security notes

Taking this approach allows cron.php to be blocked to prevent remote access.

To block remote access to cron.php, in the server, .htaccess or vhost configuration file add this section:

    <Files "cron.php">
        Order Deny,Allow
        Deny from all
        Allow from localhost
        Allow from 127.0.0.1
        Allow from xx.xx.xx.xx <-- your IP address
    </Files>

If you take this approach to call cron.php, it is probably best not to use the root user to run the cron job. A non-privileged user account, or the Apache account user, for example http-service or www-data, is a better choice. To do so, call crontab -e when logged in as a non-privileged user, or for the Apache account on a Debian server, for example, you can add a user parameter:

sudo crontab -e -u www-data

Scheduled Tasks on Windows

To setup a Windows machine to run cron.php at a specific time follow the specific instructions below. This can be useful if you are not familiar with Linux/Unix, or if your web host does not offer the ability to run cron jobs; you can run them remotely from your own computer.

Note: These instructions were written for Windows XP but should be similar in other versions of Windows.

Creating a Scheduled Task

  1. Open Scheduler
  2. Go to Start > Programs > Accessories > System Tools > Scheduled Tasks
  3. Double-click Add Scheduled Task
  4. The Scheduled Task Wizard will appear. Click Next.
  5. Select the program to run. Choose your browser from the list (for example, Internet Explorer or Mozilla Firefox). Click Next.
  6. Give the task a Name, such as Wolf CMS Cron Job, and choose the Frequency with which to perform the task (for example, Daily)). Click Next.
  7. Choose specific date and time options (this step will vary, depending on the option selected in the previous step). When finished, click Next.
  8. Enter your password if prompted. Change the username if required (for example, you'd like the task to run under a user with fewer privileges security reasons). Click Next.
  9. On the final page, select the checkbox Open advanced properties for this task when I click Finish and click Finish.

Configuring the task

  1. Go to the task's setting page either by checking the checkbox at the end of the last step, or by double-clicking on the task.
  2. In the Run box, after the text that is there now (for example, C:\PROGRA~1\MOZILL~1\firefox.exe), enter a space and then type the address to your website's cron.php page in double quotations (for example, C:\PROGRA~1\MOZILL~1\firefox.exe http://www.example.com/wolf/app/cron.php
  3. To set a frequency more often than Daily (for example, hourly), click the Schedule tab, then click Advanced. Here you can set options such as Repeat task, every 1 hour for 23 hours. Click Ok when finished.
  4. Change the start time on the task to one minute from the current time. This will allow you to test the task and make sure that it is working.
  5. When all settings have been configured to your liking, click Apply and OK (note: you may be prompted for your password)

Command-line version

Another way to perform the above commands is by using the schtasks (or at in Windows 2000) command from the command line. To duplicate the example above, which runs Firefox hourly to execute http://www.example.com/wolf/app/cron.php, open a command prompt (Start > Programs > Accessories > Command Prompt) and enter:

schtasks /create /tn "Wolf CMS Cron Job" /tr "C:\PROGRA~1\MOZILL~1\firefox.exe http://www.example.com/wolf/app/cron.php" /sc hourly

Enter your password if prompted.

Using wget for Windows to run cron

If for whatever reason you'd rather not deal with a browser window popping up on the machine, you can use wget, the Windows port of which works more or less the same as it does in UNIX. curl and lynx also have windows ports but wget is probably the easiest to set up and use.

Grab a copy of wget from your choice of either the author's site or from SourceForge. Install it to the location of your choice.

Follow the steps for Creating A Scheduled Task above, except select wget.exe as the program to run (you may need to click the Browse button to locate it if you installed from a .zip file, for example). When you get to the Advanced Properties dialog, paste in the following after the program path:

-O - -q -t 1 http://www.example.com/wolf/app/cron.php

Adjust the rest of the options as described above and test it.

Upgrading to newer versions

Every stable release of Wolf CMS includes upgrading instructions from the preceding version. Look in docs/upgrading.txt for full information.

General tips on upgrading

There are some general tips you may want to follow in upgrading to new Wolf CMS versions. Please be aware though that these tips and this document cannot take into account any customizations you may have done on the Wolf CMS core or plugins code.

  • Always make a full backup of both the database and filesystem.
  • Turn off any non-core plugins before starting to migrate.

Please be aware that we only support single version upgrades.

Suggested update scenario

This is a suggested update scenario. Please be aware that we cannot take any responsibility for any possible data loss that may occur. Also please be aware that this scenario does not take into account any possible customizations you may have done to the database structure, Wolf CMS core code or Wolf CMS plugins.

First

  1. Make a backup of your entire database.
  2. Make a backup of your entire Wolf CMS installation's directory.

Only then

  1. Turn off any non-core plugins in Wolf's administration area.
  2. Delete your entire Wolf installation. Make sure you have a complete(!) backup
  3. Rename the database if desired/possible/necessary.
  4. Install Wolf CMS from scratch and point it to the old database and the old tables.
  5. Copy back the old ”/public” directory from your backup.
  6. Update the settings in config.php and .htaccess where necessary. Use your backups as reference material.
  7. Try to login to Wolf CMS.
  8. Turn each non-core plugin on again one by one. Test each plugin before turning on the next one.

This upgrade scenarios re-uses the old database and its contents. This should work flawlessly, however, it does mean you will not have any new default data available to you.

Should re-using the database not work or if you want to have all of the data that comes with Wolf CMS by default, you will need to remove the old database, install from scratch using a clean database and then carefully copy over the contents of the old database for each table.

For obvious reasons, this is a much more time-consuming and risky scenario. Post 0.6.0 update methods of Wolf CMS include a BackupRestore plugin to aid you and help simplify this scenario.

Making backups of Wolf CMS

As all administrators are aware, having correct backups of your machines and software is extremely important in the event of a calamity.

This section describes the best way to make a backup for disaster recovery purposes and documents the various methods used to create database backups.

DISCLAIMER - While we make every effort to give you correct and useful backup techniques, we are not responsible for any damage or loss of information that might occur.

General tips on making backups

  • Always backup the Wolf CMS directory and the Wolf CMS database at the same time1) to prevent inconsistencies between the filesystem and database contents.
  • Create independent backups. Even if your hosting provider makes regular backup, always do so yourself too. This could save you a lot of trouble if you ever have a conflict with your hosting provider for example.

Backing up the filesystem

Creating a filesystem backup is very easy in both a Unix/Linux and a Windows environment assuming you have the right tools available. We expect you to have:

  • SSH access in case of a remote server
  • An (un)zip tool like TAR/GZIP or WinZip.

We will describe the Unix/Linux and Windows procedures separately.

Unix/Linux

  1. Access your webserver, remotely if applicable.
  2. Change directories to your Wolf CMS root2).
  3. Use the tar & gzip commands to create a backup.

An example set of commands assuming Wolf CMS lives in a “wolf” subdirectory would be:

cd /home/myuser/www/wolf
tar -cf /home/myuser/wolf-filebackup-20090325.tar *
gzip /home/myuser/wolf-filebackup-20090325.tar
  1. Move the resultant backup file3) to a safe location like a special backup CD in a fire proof container.
  2. Do not forget to remove the backup from your webserver afterwards to prevent unauthorized users from getting your entire site.

Windows

  1. Access your webserver, remotely if applicable.
  2. Go to your Wolf CMS root folder4).
  3. Use your favourite zip tool to create a zipfile containing the entire contents of the Wolf CMS root folder.
  4. Give the zipfile a logical name like wolf-filesbackup-20090315.zip5)
  5. Move the resultant backup file to a safe location like a special backup CD in a fire proof container.
  6. Do not forget to remove the backup from your webserver afterwards to prevent unauthorized users from getting your entire site.

Backing up the database

Your Wolf CMS database contains most of your site. It includes the layouts, snippets, users, plugin configurations and actual site contents. It is therefore crucial to have a complete and working backup.

Since each database system has its own unique backup techniques, we will describe the generally accepted methods to create a correct backup for each database type.

MySQL

Generally speaking, you can create backups of a MySQL database with web-based tools like phpMyAdmin or the commandline tool mysqldump.

If you have an account with a hosting provider, you will need to check with them on how you can make a database backup. Some hosting provider provide you with backup options in the control panel that belongs to your site's account.

If you have commandline/ssh access to your account and want to use the mysqldump command:

# mysqldump --opt -u username -p databasename > database_backup_file.sql

For more detailed information on backup and recovery of MySQL databases, please see the following resources:

MySQL version Webpage
MySQL 6.0 http://dev.mysql.com/doc/refman/6.0/en/backup-and-recovery.html
MySQL 5.4 http://dev.mysql.com/doc/refman/5.4/en/backup-and-recovery.html
MySQL 5.1 http://dev.mysql.com/doc/refman/5.1/en/backup-and-recovery.html
MySQL 5.0 http://dev.mysql.com/doc/refman/5.0/en/backup-and-recovery.html
MySQL 4.1 http://dev.mysql.com/doc/refman/4.1/en/backup-and-recovery.html

SQLite

Nothing yet..

Final word

This administration book is an experimental product and consists of dynamically generated content consisting of other wolfcms.org wiki pages. We hope you like it!

If you enjoy and use Wolf CMS, consider donating to the project.

License applicable to this content

This content is licensed under the Creative Commons Attribution Non-Commercial Share Alike license.

That license lets others remix, tweak, and build upon this work non-commercially, as long as they credit the original author and license their new creations under the identical terms. Others can download and redistribute this work just like the by-nc-nd license, but they can also translate, make remixes, and produce new stories based on this work. All new work based on this work will carry the same license, so any derivatives will also be non-commercial in nature.

For the full license details, please see the original license text at:

http://creativecommons.org/licenses/by-nc-sa/3.0/ (Human readable)

http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode (Full legal text)

1) Or almost the same time.
2) This is the directory in which you placed all of the Wolf CMS files during installation.
3) In this case: /home/myuser/wolf-filebackup-20090325.tar.gz.
4) This is the folder in which you placed all of the Wolf CMS files during installation.
5) Date is in ISO 8601 standard YYYYMMDD.
 
books/administration.txt · Last modified: 2012-03-13 16:55 by mvdkleijn
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 wolfcms.org / design by yello studio / Wolf CMS Inside