Bug 1490307 - [RFE] crontab -r should ask for confirmation or create a backup for recover in case of accident
Summary: [RFE] crontab -r should ask for confirmation or create a backup for recover i...
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cronie
Version: 7.3
Hardware: x86_64
OS: Linux
Target Milestone: rc
: ---
Assignee: Tomas Mraz
QA Contact: qe-baseos-daemons
Depends On:
TreeView+ depends on / blocked
Reported: 2017-09-11 09:56 UTC by Steffen Froemer
Modified: 2021-06-10 13:00 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-03-29 13:48:06 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Steffen Froemer 2017-09-11 09:56:00 UTC
1. Proposed title of this feature request
Provide a confirmation dialog or backup solution for `crontab -r`

3. What is the nature and description of the request?
When executing 'crontab -r' by accident, the whole crontab is cleared with no easy way of recovery. This could easily happen, as 'e' is near located of 'r' on the keyboard.

4. Why does the customer need this? (List the business requirements here)
To prevent cleaning the crontab by accident, there should be some kind of preventive tasks.

5. How would the customer like to achieve this? (List the functional requirements here)
Provide a confirmation dialog or backup the old crontab before clearing it.

6. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.
confirmation dialog: Executing `crontab -r`, the user should be asked to confirm this action
backup crontab: after executing `crontab -r`, the user should be able to recover the old crontab easily

7. Is there already an existing RFE upstream or in Red Hat Bugzilla?
nothing found

8. Does the customer have any specific timeline dependencies and which release would they like to target (i.e. RHEL5, RHEL6)?

9. Is the sales team involved in this request and do they have any additional input?

10. List any affected packages or components.

11. Would the customer be able to assist in testing this functionality if implemented?

Comment 5 Andreas Bleischwitz 2017-09-14 07:21:54 UTC

"crontab" already provides an interactive mode to ask for removal by adding "-i" to the command.

What about defaulting to be interactive by using an alias "crontab='crontab -i'" as this is already done with "rm"?

# grep rm /root/.bashrc 
alias rm='rm -i'

# rpm -qf /root/.bashrc 

If that would have to be applied to any user, the changes would need to go into /etc/skel/.bashrc

# rpm -qf /etc/skel/.bashrc

From what I read, changing the default behavior of "crontab" to ask on removal would break scripts - ok. But with that alias this shouldn't be the case - if a script fails because it's calling the alias, the fix would be to call /usr/bin/crontab directly. But this must have been the same migration as with the introduction of the "rm" alias.

Note You need to log in before you can comment on or make changes to this bug.