A simple graphical user interface (GUI) application built with Python's Tkinter library to easily schedule new cron jobs on a Linux or macOS system. This scheduler not only sets up standard cron entries but also includes optional retry logic for the command being scheduled.
- Interactive GUI: User-friendly interface built with Tkinter.
- Full Cron Schedule: Allows input for all five standard cron fields (Minute, Hour, Day of Month, Month, Day of Week).
- Command Input: Easily specify the Bash script or command to be executed.
- Retry Logic (Optional): Define a maximum number of retries and an interval between retries for the command if its initial execution fails.
- Crontab Integration: Automatically checks the current crontab and appends the new job using the
crontab -command. - Validation: Basic validation for input bounds and mandatory fields.
- User Email Save: All cron tasks and their outcomes are posted by the cron daemon to the user's email. Available through the
mailcommand. - Runnable Check: Verifies if the specified command file exists and has execution permissions (via an external
runnable_checkmodule).
- Python 3: The application is written in Python 3.
- Tkinter: Usually bundled with standard Python installations.
- Linux/macOS: The
cronandcrontabcommand must be available on your operating system.
-
Download or Clone This GitHub Repo
Make sure to save check all files exist locally.
-
Run the Application:
python3 main.py
Enter the full path to the executable script or command you wish to schedule.
Fill in the standard five cron fields. Use numbers, ranges (e.g., 1-5), steps (e.g., */10), or the asterisk (*) for "any value".
| Field | Range | Description | Default |
|---|---|---|---|
| Minute | 0-59 | Minute within the hour. | * (Every minute) |
| Hour | 0-23 | Hour of the day. | * (Every hour) |
| Day of Month | 1-31 | Day of the month. | * (Every day) |
| Month | 1-12 | Month of the year. | * (Every month) |
| Day of Week | 0-7 | Day of the week (0 and 7 are Sunday). | * (Every day) |
These fields configure the retry mechanism. Set Max Tries to 0 to disable retries.
| Field | Range | Description | Default |
|---|---|---|---|
| Interval | 0-60 | Time to wait in seconds before retrying the command. | 0 |
| Max Tries | 0-99 | The total number of times the command should attempt to run (including the first attempt). | 0 |
- Add path names of tasks and run them in sequence.
- Remove specific tasks or remove them all at once.
- Schedule tasks using the same cron entry.
Click the Add Cron Job button. The application will attempt to add the entry to your user's crontab and provide feedback on success or failure through cron emails.
The application updates the crontab by:
- Fetching the current active crontab using
crontab -l. - Constructing the new cron job line (using the
rf.retry_failuresfunction if retries are enabled). - Combining the old crontab content and the new cron job.
- Piping the entire new content back to the
crontabcommand:echo new_crontab_content | crontab -.
This method ensures that existing cron jobs are preserved.