+1-855-211-0932 (ID:287497)
Don't have an account yet? Sign up now!

HomeArticlesAllowed File Extensions for Crontab Executions

Allowed File Extensions for Crontab Executions

Allowed File Extensions for Crontab Executions

Files That Could Be Executed with Crontab - Allowed File Extensions

Category: Tools & Settings

Introduction

In this guide, we will explore the various file types that can be executed using crontab on your hosting account. Understanding these allowed file extensions is essential for ensuring that your cron jobs run smoothly and efficiently.

Compatible File Types

There are no specific file types that are restricted when it comes to execution from your account. However, during our testing, the following three script types have demonstrated excellent compatibility with cron jobs:

  • PHP scripts: Files with the .php extension
  • Perl/CGI scripts: Files with the .pl extension
  • Bash scripts: Files with the .sh extension

Setting Execute Permissions

For files included in a cron job entry, they must be Unix executables, which means they need to have execute permissions set. You can manage file permissions easily through our File Manager:

  1. Go to Files > File Manager in your Control Panel.
  2. Select the desired file.
  3. Set the permissions to 700 or 755, with 755 being the more commonly used format.

Optimizing Perl Cron Jobs

When specifying a new Perl cron job from our Crontab menu, it is highly recommended to include the command perl at the start of the Command to execute field. This ensures optimal support for the cron job:

perl /path/to/your/script.pl
            

If you omit this step, there is a risk that the cron job may not execute properly, and you might not receive the expected output.

Common Errors and Resolutions

When receiving the output of a cron task via email, you may encounter an error stating TERM environment variable not set along with other output messages. To resolve this issue, start your bash script files with the following code:

#!/bin/bash
TERM=linux
export TERM
            

Conclusion

By understanding which file types can be executed with crontab and how to set the appropriate permissions, you can effectively manage your cron jobs and ensure they function as intended. Follow these guidelines to maximize your scripting capabilities and streamline your task automation.



Tags: , , , , , , , , , , ,

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>