Cloud Hosting/Cron

From XMission Wiki
Revision as of 15:53, 16 November 2016 by Boom (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Cron enables users to schedule jobs (commands or shell scripts) to run automatically at a certain time or date. It is commonly used to automate system maintenance or administration. Some CMS like Drupal use cron to automate some tasks.

To edit what jobs are scheduled, first SSH to your container, then run:

crontab -e

This should open up an empty crontab if this is your first time using Cron.

Cron uses the following syntax to schedule jobs.

5 * * * * /user/bin/php5 /path/to/script >/dev/null 2>&1

minute hour day month day-of-week command-line-to-execute

Some examples of proper scheduling syntax:

*/5 * * * * : Run cron every 5 minutes
* */1 * * * : Run cron every hour
* * */3 * * : Run cron every 3 days
* * * */1 * : Run cron once every month
*/5 * */3 * * : Run cron every 5 minutes, all day, every 3rd day.
30 0 * * * : Run cron at 12:30 every day

An example of a cron job which will remove all the contents of a cache directory every 3 days:

* * */3 * * rm -rf /var/www/vhosts/domain.com/http_docs/cache/*

If you want to see the output, you can have it email to you:

*/5 * * * * /usr/bin/php5 /path/to/script 2>&1 | Mail -E -s "Email Subject here" address@domain.com

You can also redirect the output to a log file:

*/5 * * * * /usr/bin/php5 /path/to/script >> /home/users/u/username/cronlog.log 2>&1
  • Adding >> will continue to append the log. If you just want to see the output once just add > instead of >>


To list all cronjobs in your crontab:

crontab -l




Cloud Hosting - Getting Started

To manage your Cloud Server, you will access the XMission Cloud Hosting Control Panel

For assistance in navigating your XMission Control Panel, please visit

Secure your Website

What is a SSL Certificate and How does it work?

Please vist to review a quick overview on why securing your website is a good idea.

Protect your Website

If you would like to learn how to control access to your server Click Here

  • XMission does recommend consulting a PHP or Apache Developer to ensure your .htaccess file is configured correctly. This could block total access to your Cloud Server.

FTP Access

FTP Access is typically recommend to connect to your Cloud Server. XMission requires SFTP Access to all hosting servers and suggests using FileZilla. To get help with acessing your server via FTP Click Here

SSH Access

From time to time you may need or want to use the command line to log in to your server. Your Cloud Server is accessible via a Secure Shell Interface also referred to as SSH. For help accessing your server via SSH please Click Here

Server Logs

You may need to look at your server logs. These can be access via SSH or FTP. To locate those logs Click Here

Scheduled Tasks

Cron enables users to schedule jobs (commands or shell scripts) to run automatically at a certain time or date. Some best practices to setting up Cron's:

  • Creating Scheduled Jobs with Crons

Migrating MySql

If you are moving an excising website to your XMission Cloud Server, a MySql Database is most likely needed. If you'd need some help importing that database please Click Here

Cloud PHP Info

XMission's Default PHP Info for your Cloud Server: PHP Info

Host Files

How to set up Host Files

SSH Keys

SSH keys allow users to SSH to servers with a more secure method rather than having to rely on passwords alone. To set up SSH Keys Click Here

Server Security

For customers that sign up for Unmanaged Cloud Servers, XMission strongly recommends a few easy steps to take to ensure that your unmanaged Cloud Server stays up-to-date and secure at all times.