https://github.com/cuddlyclara/safecron
Wrapper for crontab that automatically includes the -i flag, preventing accidental deletion of the user's crontab with the -r flag.
https://github.com/cuddlyclara/safecron
bash crontab linux shell wrapper
Last synced: about 2 months ago
JSON representation
Wrapper for crontab that automatically includes the -i flag, preventing accidental deletion of the user's crontab with the -r flag.
- Host: GitHub
- URL: https://github.com/cuddlyclara/safecron
- Owner: cuddlyclara
- Created: 2025-01-14T14:33:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-14T14:53:43.000Z (over 1 year ago)
- Last Synced: 2025-06-05T09:05:40.939Z (about 1 year ago)
- Topics: bash, crontab, linux, shell, wrapper
- Language: Shell
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# SafeCron
SafeCron is a wrapper for the `crontab` command that automatically includes the `-i` flag to prevent accidental deletion of the user's crontab when using the `-r` flag.
## Installation
To install SafeCron, use one of the following methods:
### Using `wget`
```bash
sudo wget -q https://raw.githubusercontent.com/cuddlyclara/safecron/refs/heads/main/safecron.sh -O /usr/local/bin/safecron && sudo chmod +x /usr/local/bin/safecron
```
### Using `curl`
```bash
sudo curl -s https://raw.githubusercontent.com/cuddlyclara/safecron/refs/heads/main/safecron.sh -o /usr/local/bin/safecron && sudo chmod +x /usr/local/bin/safecron
```
## Usage
Once installed, you can use `safecron` just like the regular `crontab` command. It will automatically include the `-i` flag for safety, preventing any accidental deletion of crontab entries.
### Example
To edit your crontab:
```bash
safecron -e
```
If you run the following command to delete your crontab:
```bash
safecron -r
```
You will always be prompted with the following question:
```
crontab: really delete user's crontab? (y/n)
```