Internet Servers - iServer Virtual Servers for Reseller Hosting

iServer Virtual Servers

iServer Virtual Server Extensions
iServer Electronic Commerce ComponentsiServer Electronic Commerce Components
Remotely manage your web site with iManager & iRootRemotely manage your web site with iManager & iRoot
Partition your Virtual Server into multiple Virtual HostsPartition your Virtual Server into multiple Virtual Hosts
Generate statistical reports of your web site traffic using WebTrendsGenerate statistical reports of your web site traffic using WebTrends
Web Publishing using HTTP PUTWeb Publishing using HTTP PUT
Remotely author your web site content with Microsoft FrontPageRemotely author your web site content with Microsoft FrontPage
Map your Virtual Server to you Windows 95/NT DesktopMap your Virtual Server to you Windows 95/NT Desktop
Add security to your Virtual Server with Secure Socket Layer (SSL)Add security to your Virtual Server with Secure Socket Layer (SSL)
Create and manage databases with mSQLCreate and manage databases with mSQL
Create and manage databases with MySQLCreate and manage databases with MySQL
Create and manage databases with PostgreSQLCreate and manage databases with PostgreSQL
Add Real Audio/Video streaming capability to your Virtual ServerAdd Real Audio/Video streaming capability to your Virtual Server
Miva/Htmlscript: HTML based web development languageMiva/Htmlscript: HTML based web development language
PHP: HTML based web scripting languagePHP: HTML based web scripting language
Automate information dissemination using AutorespondersAutomate information dissemination using Autoresponders
Customize your Virtual Server to handle any MIME typeCustomize your Virtual Server to handle any MIME type
Build and compile Java Applets using the Java Virtual MachineBuild and compile Java Applets using the Java Virtual Machine
Change passwords remotely using the poppassd serviceChange passwords remotely using the poppassd service
Schedule events to run at periodic intervals with cronSchedule events to run at periodic intervals with cron
Use the virtual finger service to look up user informationUse the virtual finger service to look up user information
Automatically reload daemons at system startup (RealServer, Ewgie, etc)Automatically reload daemons at system startup (RealServer, Ewgie, etc)
Step by step installation instructions for popular third party programsStep by step installation instructions for popular third party programs
iServer Home PageiServer Virtual ServersOrder Your iServer Virtual ServeriServer Technical SupportiServer Reseller ProgramSearch iServer Web Pages
Event Scheduler (cron)
The iServer Virtual Server System includes access to a daemon¹ which can execute scheduled commands. This daemon, commonly known as "cron", reads a file of dates and commands that you build called a cron table or "crontab" for short. With your individual crontab, you can in effect tell the system to `run this command at this time on this date'.

Your individual crontab can be stored in any file you choose. For example, you may wish to create a file "cronjobs" in your home directory for your cron table. The following paragraphs explain the format of your crontab file and is adapted from the manual page on crontab (section 5). If you would like to review the man page, you may do so by connecting to your Virtual Server and typing "man crontab" or "man -s 5 crontab". For your convenience, we have provided you an on-line crontab man page for your review.

Each line in your crontab will either be an environment setting or a cron table entry. Lines that begin with "#" are considered comments and are ignored. An environment setting is of the form,

    NAME = VALUE

Several environment variables are set up automatically by the cron daemon. These include SHELL, LOGNAME, USER, and HOME. In addition to these settings, cron will look at a special environment variable, MAILTO. Any output generated by your cron jobs will be sent to the address specified by MAILTO (if it is not specified it will be sent to the owner of the crontab). If MAILTO is defined by empty (MAILTO=""), no mail will be sent.

The format of the cron table entry includes five (5) time fields followed by a command. Commands are executed when the time specified by the date fields matches the current time. The five time fields are as follows:

FieldAllowed Values
minute        0-59
hour        0-23
day of month        0-31
month        1-12 (or names, see below)
day of week        0-7 (0 or 7 is Sun, or use names)

A field may be an asterisk (*), which indicates all values in the range are acceptable. Ranges of numbers are allowed, i.e. "2-5" or "8-11", and lists of numbers are allowed, i.e. "1,3,5" or "1,3,8-11". Step values can be represented as a sequence, i.e. "0-59/15", "1-31/3", or "*/2".

Names can be used for the "month" and "day of week" fields. Use the first three letters (case-insensitive) of the particular month or day. Ranges or lists of names are not allowed.

The actual command you wish to execute is the sixth field of a cron table entry. Some examples of complete cron entries are show below:

   MAILTO="someone@somewhere.com"
Explanation: sets the environment variable MAILTO to "someone@somewhere.com". Any output generated by the cron entries will be sent to this address.

15 1 * * *   [COMMAND]
Explanation: executes the command [COMMAND] at 1:15 AM every day

40 23 1 * *   [COMMAND]
Explanation: executes the command [COMMAND] on the first of every month at 11:40 PM

0-30/10 9,17 * * 1-5   [COMMAND]
Explanation: executes the command [COMMAND] on Monday-Friday (1-5) every 10 minutes for the first half hour (0-30/10) of the 9 AM and 5 PM hours (9,17)

0 */4 * jan sun   [COMMAND]
Explanation: executes the command [COMMAND] on each Sunday in January at midnight, 4 AM, 8 AM, noon, 4 PM, and 8 PM

30 4 1,15 * fri   [COMMAND]
Explanation: executes the command [COMMAND] at 4:30 AM on the 1st and 15th of each month, plus every Friday

0 0 19 8 *   [COMMAND] or
0 0 19 aug *   [COMMAND]
Explanation: executes the command [COMMAND] at midnight on August 19th

After you have defined the cron table entries in your cronjobs file, you will need to register your crontab with the system. This can be done by running the command "crontab". For example, if you created your crontab file and named it "cronjobs" and stored it in your home directory, then telnet or SSH to your Virtual Server and type the following command:

    crontab cronjobs

This will register your cron table file with the cron system daemon. If you ever need to review the current cron entries you have registered with the cron system daemon, you need simply type "crontab -l".

Cron Tutorial: Clearing Your Log Files
Your Virtual Server includes a complete set of configuration files and log files (when can be in Separate or Combined format) for your Virtual Web Service. Your web server logs are appended to every time someone visits your site. Over time these logs can grow to be very large and can consume all your available disk space if not managed correctly².

You can easily define a simple cron table entry in your cronjobs file to nuke your log files. The instructions included below guide you through this process step by step.

  1. Create a cronjobs file
    You can do this on your local computer in Notepad or you can create the file directly on your Virtual Server using your favorite UNIX text editor (pico, vi, etc). Your file should contain the following entries:

        MAILTO="USER@YOUR-DOMAIN.NAME"
        0 1 1 1-12/3 *   /usr/local/bin/vnukelog

    This will run the command "/usr/local/bin/vnukelog" (which clears all of your log files) at 1 AM on the first day of the first month of every quarter, or January, April, July, and October (1-12/3). Obviously, you will need to substitute a valid e-mail address in the place of "USER@YOUR-DOMAIN.NAME".

    If you have created this file on your local computer, FTP the file up to your Virtual Server and store it in your home directory under the name "cronjobs" (you can actually use any name you would like).

  2. Register your cronjobs file with the system
    After you have created your cronjobs file (and have uploaded it to your Virtual Server if applicable), you need to
    telnet or SSH to your server and register the file with the cron system daemon. To do this, simply type:

        crontab cronjobs

    Or if you used a name other than "cronjobs", substitute the name you selected for the occurrence of "cronjobs" above.

That's all there is to it! You can list your registered cron table entries by typing the command "crontab -l" or remove all of your registered cron table entries by typing "% crontab -r".


NOTES

¹ - a daemon is a server process initiated at boot time that waits in the background until its service is required.

² - it is possible to turn the logging capability of your web server off. You can find out more information about turning off the logging capability of your web site in the iServer Support Staff Commonly Asked Question Archive.



Return to the iServer Home Page Review copyright information Contact the iServer Staff Making Money as an iServer Reseller Order your iServer Virtual Server Hosting 12020 Virtual Servers and 60449 Domain Names, iServer is the world leader in Virtual Server Technology Perform a search on the iServer Web Site General information about iServer and iServer web site navigation help Lost? ...View our Web Site Map Rebuild this page (iServer Staff only) Gateway to iManager (iServer Staff only)      This web site is powered by iServer