Appendix
From XCloner Official Manual
Appendix
Execute a cron job from within XCloner
Go to Administration – Configuration. Clik the Cron tab. To execute a cron job from the cron tab, click execute cron.
If you receive the following error message, then add the IP from the error message to the allowed IPs field on the cron tab. Make sure to add the name of the configuration file to the Configuration Name field before you click Save. See Making changes to an existing cron configuration file.
Now execute the cron job again. You should see a message similar to the one below.
You should also receive a notification message in your email.
How to create a crontab file
A cron job can be used to back up data, to automatically send out emails at a certain time, etc. In order to execute such a cron job, you need a crontab file. The crontab file is nothing more than a very small and simple text file that contains a schedule (when should the cron job be executed) and the path to your cron script (which cron job should be executed).
You will have to place this crontab file on your server using a shell account so that your server can execute the cronjob at the moment you have specified in the crontab file.
This section will explain how to create a crontab file and how to place that crontab file on your server.
Crontab file
A crontab file consists of five time and date fields, followed by the path to your script. It can look like this:
15 11 1 3 1 /home/username/www/mycronjob.php
The time and date fields are:
| field | allowed values |
|---|---|
| minute | 0-59 |
| hour | 0-23 |
| day of month | 1-31 |
| month | 1-12 |
| day of week | 0-7 (0 or 7 is Sun) |
So the line above means that the script mycronjob.php will be executed at 15 minutes, 11 hours (meaning a quarter past eleven), on the first day of the month (1), in the month March (3), on a Monday (1).
Instead of a single number, you are also allowed to use ranges. Let’s say you want the script above to be executed three hours in a row, at 9:15, 10:15 and 11:15. It would look like this:
15 9-11 1 3 1 /home/username/www/mycronjob.php
You may have noticed that the fields ‘day of the month’ and ‘day of the week’ might contradict each other. The first day of the month does not have to be a Monday. To solve this, you are also allowed to use * to mean all possible values.
Let’s say you want this script to run every 1st of the month, no matter what day of the week or what month it is. The script would look like this:
15 9-11 1 * * /home/username/www/mycronjob.php
Some other examples:
52 * * * * will run every hour on the 52nd minute.
43 18 * * 7 will run at 6:43pm every Sunday.
That’s all there is to creating a crontab file. You specify when it should run and what script to execute.
Placing the crontab on your server
If you have no experience with this, it might be smart to get in touch with your host and ask them how to do this.
Option 1 – Crontab Manager If your host has a cron tab manager you will only have to login to your control panel and find the cron tab manager (might be under FTP options).
Fill out the schedule as explained above, enter the command line and save the settings. Command lines can be one of the following:
/usr/bin/php /path_to_backup_dir/cloner.cron.php
or
links http://link_to_backup_dir/cloner.cron.php
or
lynx -source http://link_to_backup_dir/cloner.cron.php
For Running Multiple Crons, you need to first create a custom configuration file in the XCloner Configuration -> Cron tab and then replace "cloner.cron.php" with "cloner.cron.php?config=myconfig.php", only use 'links' or 'lynx' options to run the cronjob.
Option 2 – SSH or Telnet
1. Create your crontab file (as described above) in Notepad. Make sure to have wordwrap turned off and press enter once (to create a blank line after the cron job line).
2. Save the file as cron.txt.
3. Upload the file to your root directory.
4. Use SSH or Telnet software to connect to your server (PuTTY (http://www.putty.org) is a free open source SSH and Telnet client)
5. Type the following at the command prompt: crontab cron.txt
6. Press Enter to return to the command prompt
7. Now type crontab -l (that’s a lowercase L)
8. Press Enter again
9. You will be shown a list of all the cronjobs you had save in your cron.txt file
10. You’re done. Your cronjob will run according to the schedule you have indicated and you will receive a notification email every time your cronjob runs.
Backup Email Notification
This is a typical email notification for an XCloner backup.
Backup confirmation message for automatic process
For the automatic process, you should get a confirmation message like this:
| Archive Name | backup_name.tar | name or the created backup |
| Number of Files | 1080 | total number of files in the backup |
| Size of Original File | 369.8 MB | the size of the backup without archiving |
| Size of Archive | 276.94 MB | the current archive size on server |
| Database Backup Settings | Completed (3.85MB) | will inform you how the database backup went. You can check the file size by opening the archive and looking at administrator/backups/database-sql.sql |
Making changes to an existing cron configuration file
To make any changes to an existing cron configuration file, make sure to add the name of the configuration file to the Configuration Name field before you click Save. This field is blank by default to prevent you from accidentally saving changes to the wrong configuration file.
If you don’t add the name of the cron job to the field (even if you have only one cron configuration file) your changes will not be saved when you click the Save button.
What is the manual process?
The manual process was created to help users who have limitations on the time a PHP script can be executed. For example if you need to run the backup process for more than 30 seconds, and your host only allows the script to run no more than that limit , the script will end prematurely and get you either a blank screen or a 500 error.
The solution is to set Manual Backup to Yes. This will allow for the creation of incremental backups. The administrator will configure how many files should be processed by session so the script will fit the time limit, and when starting the backup process, XCloner will refresh the backup adding x number of files at a time.
Note: This is also an automatic process, you don't need to take any other action (except starting the backup process) but you will need to leave your browser open for refreshing.
Note: The manual backup process doesn't work in cron mode, the cron process will set the Manual Backup option to No.
Possible Run Time Problems
You may run into the following errors or problems during the restore process.
Process stops before it is finished
Increase the max_execution_time variable in your php.ini configuration file, and/or increase the memory_limit variable.
The database details provided are incorrect and/or empty. Unable to connect to MySQL
The provided MySQL details were incorrect, you need to verify them.
Could not continue, unable to read the clone backup file
You didn't select a backup to restore from the drop down menu Choose clone archive to install
Directory /home.../mydir/ is not writeable or does not exist. Could not continue...
You need to verify that your Install URL exists and it has writing permissions
500 error
Possible causes:
• The permissions are set to 777 on the file or directory you are in. You need to set them to 755. This only happens on some servers.
• You have a .htaccess in the present directory, you need to remove any code from it that's not supported by your host, usually replacing it with a default Joomla one will do the job.
XCloner Limitations
XCloner works as a backup script, so its job is to read file data and archive it. Because of some server configurations there are 2 types of limitations:
Memory Limitation
The XCloner needs to use more memory than it has been allocated. This is usually related to the memory_limit variable and occurs when XCloner generates backups without the server utilities support.
Time Limitations
Some hosts are configured in a way that if a PHP script runs for more than a certain time limit, it will be stopped; giving back a connection timeout, a save index.php message, a blank page, or a 500 error. This is related to the max_execution_time variable but also to an expire setting in the Apache httpd.conf file.
Solutions
For the memory limitation, we have introduced the possibility for users to use server utilities instead of PHP functions to archive the file data. To be able to use this functionality, you will have to check that you have tar utilities and MySQLdump for MySQL backups installed on your server and that your hosts allows you to access them through the PHP exec() function.
If for any reason you can't use the server utilities for backups, you will need to increase the memory_limit in your php.ini file if you encounter any problems. See http://ro.php.net/manual/en/ini.core.php for more information.
For the time limitation XCloner has added the Manual Backup option. By choosing the option Manual Backup in the XCloner configuration your backup will get created in incremental mode--it will archive a certain number of files per session until it reaches the last file. That way the total backup process is split into smaller pieces, avoiding the time limitation. The only requirement to be able to use this option is that you have JavaScript enabled in your browser.
If you want to generate your backup at once, without using the refresh mode, you will need to increase this variable max_execution_time in your php.ini file. See http://ro.php.net/manual/en/ini.core.php for more information.
Why is my backup file incomplete or corrupt?
This happens only when the cloning process was stopped by a server error, and the archive couldn't be completed. Try to increase your php.ini memory_limit (see above), or set the Backup using Server Functions option in your configuration area to Yes. For more information please refer to our Requirements page http://www.joomlaplug.com/Tools/JoomlaCloner/JoomlaCloner_Requirements.html
Upgrading XCloner
Upgrading JoomlaCloner is a simple two step process.
1. Uninstall your current version of XCloner
2. Install the new, updated version
Usually the only thing you need to check after upgrading is the configuration area.





