|
| 1 | + |
| 2 | +# Automated Task Scheduler for Repetitive Tasks |
| 3 | + |
| 4 | +This script is designed to automate repetitive tasks by scheduling them at predefined intervals using Python's `schedule` library. It logs task execution, making it easy to track the status of scheduled jobs. |
| 5 | + |
| 6 | +## Functionalities |
| 7 | + |
| 8 | +- Schedule and automate repetitive tasks. |
| 9 | +- Log task execution to a file for monitoring and debugging. |
| 10 | +- Customizable task functions to fit user needs. |
| 11 | + |
| 12 | +## Setup Instructions |
| 13 | + |
| 14 | +1. **Clone the repository:** |
| 15 | + ```bash |
| 16 | + git clone <repo-link> |
| 17 | + ``` |
| 18 | + |
| 19 | +2. **Navigate to the project directory:** |
| 20 | + ```bash |
| 21 | + cd automated-task-scheduler |
| 22 | + ``` |
| 23 | + |
| 24 | +3. **Install the required dependencies:** |
| 25 | + ```bash |
| 26 | + pip install -r requirements.txt |
| 27 | + ``` |
| 28 | + |
| 29 | +4. **Run the script:** |
| 30 | + ```bash |
| 31 | + python task_scheduler.py |
| 32 | + ``` |
| 33 | + |
| 34 | +## Detailed Explanation of Script |
| 35 | + |
| 36 | +- **Task Functions:** `task_one` and `task_two` are sample tasks. You can modify these functions to suit your automation needs. |
| 37 | + |
| 38 | +- **Scheduling:** The script schedules `task_one` to run every 10 minutes and `task_two` to run every hour using the `schedule` library. You can adjust these intervals in the `setup_schedule()` function. |
| 39 | + |
| 40 | +- **Logging:** Each task's execution is logged in the `task_scheduler.log` file with timestamps, providing visibility into when tasks were run. |
| 41 | + |
| 42 | +- **Main Loop:** The script continuously runs in an infinite loop (`run_scheduler()`), checking for pending tasks and executing them at the scheduled times. |
| 43 | + |
| 44 | +## Output |
| 45 | + |
| 46 | +The script generates a `task_scheduler.log` file, which logs the execution of tasks like this: |
| 47 | + |
| 48 | +``` |
| 49 | +2024-10-13 12:00:00 - Task 1 is running |
| 50 | +2024-10-13 12:10:00 - Task 1 is running |
| 51 | +2024-10-13 13:00:00 - Task 2 is running |
| 52 | +``` |
| 53 | + |
| 54 | +## Author(s) |
| 55 | + |
| 56 | +- ARNAV RAJ |
| 57 | + |
| 58 | +## Disclaimers |
| 59 | + |
| 60 | +- Ensure that the script is running continuously in the background for tasks to execute as scheduled. |
| 61 | +- The `schedule` library is suitable for lightweight task scheduling. For more complex scheduling requirements, consider using a task queue like Celery or a cron job. |
0 commit comments