post your comment   print   send to a friend
Rate:  62% | Views: 2836
Question categories:  Unix Plans

can i set cron jobs with my unix-based shared hosting plan?

Answer by: George Kaloyanov, Aplus.Net Knowledge Base Support

Cron Jobs are supported with Aplus.Net’s Unix-based shared hosting plans. Cron Job is used on a Unix operating system to schedule commands to be executed periodically. You will need to activate your SSH access to the server in order to set your own cron jobs. You have to update the contents of your Cron Table text file in order to add your new cron job to it. You can do that by executing the following command: ‘crontab –e’. This will open the crontab file for editing.

Note: If this is your first cron job, the ‘crontab –e’ command will also create the initial crontab text file.

Each Cron Job has 6 components:

  • Minutes: From 00 to 59 -> the exact minute the cron job executes
  • Hour: From 00 to 23 -> hour of the day the cron job executes (0 = midnight)
  • Day: From 00 to 31 -> day of the month the cron job executes
  • Month: From 01 to 12 -> month of the year the cron job executes
  • Weekday: From 00 to 06 -> day of the week the cron executes (Sunday = 0, Monday = 1,  and so on)
  • Command -> the exact command that has to be executed.

CRON JOB EXAMPLES:

In the following examples we will use a PHP script file (cron.php) which you want to run periodically. However, you can set up cron jobs for any supported languages such as Perl or Python. Since PHP is located at /usr/local/bin/php and the full path to your PHP script file is /home/partition/yourFTPusername/html/cron.php, here is what you need to have in your crontab text file:

  • 25 22 * * * /usr/local/bin/php /home/partition/yourFTPusername/html/cron.php – the script will be executed at 22:25 each day.
  • 00 22 * * 01 /usr/local/bin/php /home/partition/yourFTPusername/html/cron.php – the script will be executed at 22:00 on every Monday.
  • * 3,4 * * * /usr/local/bin/php /home/partition/yourFTPusername/html/cron.php – the script will be executed at 3AM and 4AM each day.

Note: How could I find the full path to my web hosting directory?

CRON JOBS RESTRICTIONS:

  • Your cron job should not run more than once every hour.
  • The process should not open ports on the shared hosting server.
  • The process should not use more than 50% of the shared hosting server resources (CPU, Memory).
  • The process should not run for more than several minutes.

Important: If your cron job does not meet any of the requirements above, your shared hosting account might be suspended by Aplus.Net’s administrators.

Related links:

Customer Feedback
Rate:  62% | Views: 2836 | Please Rate:  
 
If you have other comments or ideas for future technical tips, please type them here:

Email: (optional)

Comments: (optional)

 Server Hosting | PHP Hosting    Back to serch results
Browse the Base
Knowledge Base
Shared Hosting
  Unix Plans
    MySQL
Messages
 

Powerful firewall service!

For dedicated servers only. Absolute security, no attacks, no viruses, any port. Hardware solution does not use any of your server's resources. You cannot afford not to have it. Click below to check it out!
More info...

Private Area
 
Ask
in Private
   
Personal
Folder
 
Related Questions
 
1. I have a Unix-based shared hosting plan. How can I change permissions for files/directories using the File Manager?
 
2. How can I protect directories?
 
3. How to Set Up a Storefront ?
 
4. What are the permissions on files and directories?
 
5. In Unix, what is the find command, and how do I use it to search through directories for files?
 
Home Browse Search Ask in Private Personal Folder   Help
powered by web hosting 
  Logged as: Guest