Handyman Service - Documentation
Handyman Services

How to set Cron Job for subscription plan expire?

Set Cron Job for subscription plan Expire

1. Locate the Cron Jobs Section

  • Scroll down to the “Advanced” section.
  • Click on “Cron Jobs”.

2. Choose Email Notifications (Optional)

  • If you want to receive an email whenever a cron job runs, enter your email in the “Cron Email” section.

3. If you don’t want emails, add >/dev/null 2>&1 at the end of your cron command.

4. Add a New Cron Job

5. Select the Execution Time

  • Under “Add New Cron Job”, choose how often the command should run:
  1. Common Settings: Select from predefined options like “Once Per Day” or “Every 5 Minutes”.
  2. Custom Timing: Manually set the values:
  • Minute: 0-59 (e.g., 0 for every hour)
  • Hour: 0-23 (e.g., 2 for 2 AM)
  • Day: 1-31 (specific days of the month)
  • Month: 1-12 (specific months)
  • Weekday: 0-7 (0 or 7 for Sunday, 1 for Monday, etc.)

6. Enter the Cron Command

  • The command should include the script you want to run. Examples:
  • php /home/username/public_html
  • (Replace username with your actual cPanel username)

Run Every Hour: 0 * * * * php /home/username/public_html

Run Every Day at Midnight : 0 0 * * * php /home/username/public_html

Disable Email Notifications : php /home/username/public_html >/dev/null 2>&1

7. Save the Cron Job

  • Click “Add New Cron Job” to save it.

8. Verify the Cron Job

  • Check if the cron job is listed under “Current Cron Jobs”.
  • You can manually run the script in a browser or via SSH to confirm it works.

Additional Notes:

  • Ensure the script has executable permissions (chmod 755 script.php via SSH or File Manager).
  • Some shared hosting providers require the full path to PHP (/usr/bin/php).
  • If using wget, the command looks like this:

command: cd /home/your_username/public_html && /usr/local/bin/php artisan schedule:run >> /home/your_username/cron.log 2>&1