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:
- Go to Files > File Manager in your Control Panel.
- Select the desired file.
- Set the permissions to
700
or755
, with755
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: bash scripts, CGI, Control Panel, cron jobs, crontab, error resolution, execute permissions, file extensions, Perl, PHP, script compatibility, Unix executables