Back to Cron Helper
Recipephpbackendscripting

Run Raw PHP Script

Execute a PHP background worker script.

You can run PHP scripts directly from the command line without a web server. This is useful for background workers, email processors, or cleanup tasks that shouldn't be exposed to the public web.

Cron Schedule

Every 30 Minutes*/30 * * * *
Runs at the top and bottom of every hour (minutes 0 and 30).

Command to Run

Copy and paste this command into your crontab or automation script

/usr/bin/php /var/www/html/worker.php
This command will run according to the cron schedule above.

Implementation Examples

Here are code examples for implementing this cron job in different programming languages:
Unix/Linux Crontab
*/30 * * * * /path/to/script.sh
Python (with schedule library)
schedule.every(30).minutes.do(job)
Node.js (with node-cron)
cron.schedule('*/30 * * * *', () => {
  console.log('Running every 30 minutes');
});
Go (with robfig/cron)
c.AddFunc("*/30 * * * *", func() { fmt.Println("Run every 30 mins") })
GitHub Actions Workflow
- cron: "*/30 * * * *"

Related Cron Recipes

Automate PostgreSQL Backups Daily

How to schedule a daily PostgreSQL database backup using cron.
databasepostgresbackup

Automate MySQL Backups Daily

Schedule a daily MySQL database dump using cron.
databasemysqlbackup

Automate MongoDB Backups Daily

How to schedule a daily MongoDB backup using cron.
databasemongodbbackup

Automate Redis RDB Snapshots

Schedule a Redis background save (snapshot) via cron.
databaserediscache

PostgreSQL Vacuum Analyze

Automate PostgreSQL database maintenance with VACUUM ANALYZE.
databasepostgresmaintenance

Sync Folder to AWS S3

Cron job to sync local files to an AWS S3 bucket.
awscloudbackup