Using Cron Jobs in cPanel (Firstserv Guide)
Cron is a built-in Linux task scheduler that allows you to automate tasks on your server. It’s highly flexible and can run scripts, commands, or processes at set intervals.
Firstserv provides an easy way to manage cron jobs via cPanel, without needing to work directly with system files.
Accessing Cron Jobs
- Log in to cPanel
- Navigate to:
Advanced → Cron Jobs
Cron Email Notifications
By default, cron output is sent to your account’s main email address.
Change Notification Email
- In the Cron Jobs page, locate the email section at the top
- Enter your preferred email address
- Click Update Email
✅ Useful for monitoring job output or errors
Adding a Cron Job
Step 1: Set the Schedule
You can choose:
- ✅ Common Settings (e.g. once per day, every 5 minutes)
- ✅ Or set custom values for:
- Minute
- Hour
- Day
- Month
- Weekday
Step 2: Add the Command
Cron jobs run commands in the format:
<executable> <options> <script path>
Example: Running a PHP Script
Breakdown:
- /usr/bin/php → PHP executable
- -q → Quiet mode (suppresses output)
- /home/username/... → Full path to your script
Step 3: Save
- Click Add New Cron Job
✅ Your task will now run automatically based on your schedule
Managing Existing Cron Jobs
Edit a Cron Job
- Scroll to Current Cron Jobs
- Click Edit
- Update schedule or command
- Click Edit Line to save
Delete a Cron Job
- Click Delete next to the job
- Confirm deletion
✅ This stops the task from running
Common Examples
Trigger WordPress Cron (wp-cron.php)
Explanation:
- wget fetches the URL
- -O /dev/null discards output
Run a Script Directly
Requirements for Executable Scripts
Your script must:
- ✅ Include a valid shebang at the top:
- ✅ Have correct permissions:
Understanding Output Redirection
This tells the system:
- > → Redirect output
- /dev/null → Discard output (“black hole”)
- 2>&1 → Send errors to the same place
✅ Prevents emails being sent for every cron execution
Best Practices
- ✅ Always use full file paths
- ✅ Test your command manually before scheduling
- ✅ Use output redirection to avoid unnecessary emails
- ✅ Keep schedules reasonable (avoid overloading resources)
Using Cron Without cPanel
If you're using a VPS or dedicated server without cPanel:
- Cron jobs can be configured manually using:
crontab -e
- Consult your system administrator if needed
Summary
- Cron jobs automate tasks on your hosting account
- Configure them easily via cPanel → Cron Jobs
- Set schedules and commands to run scripts automatically
- Use output redirection to keep logs clean
- Edit or remove jobs at any time
Need Help?
If you need assistance setting up or troubleshooting cron jobs, the Firstserv support team is always happy to help.
