Scheduler script is not working

i am writing scheduler script to send email for timesheet reminder

but its not working

import frappe
from frappe.utils import get_url

def send_timesheet_reminder():
employees = frappe.get_all(‘Employee’, filters={‘status’: ‘Inactive’}, fields=[‘name’, ‘user_id’, ‘employee_name’])

for employee in employees:
    if employee.user_id:
        # Personalize the message with the employee's name
        message = f"Dear {employee.employee_name},\n\nPlease submit your timesheet by the end of today.(Dont take any leave till 28 specially for kavya)\n\nBest Regards,\nNstarxinc"

        # Send an email notification
        frappe.sendmail(
            recipients=employee.user_id,
            subject="Reminder: Submit Your Timesheet",
            message=message
        )

@Prashanth_Kolhetkar please change status inactive to Active
employees = frappe.get_all(‘Employee’, filters={‘status’: ‘Active’}, fields=[‘name’, ‘user_id’, ‘employee_name’])

Hi @Prashanth_Kolhetkar

Check schedule is enabled on your site or not?

@Usama_Naveed its already enable

image (27)

Are you applying in the server script doctype?, and your corn format is

* * * * *

means it will run on every minute!

so I think, for that case, you have to run the “daily” cron job instead of the “every minute” with logic.

yes i want every min later on i will change based on scenario

but its not working

It’s a sample script, right?

Did you update that line as @Jeel said.

no becoz i want to send it for inactive for testing