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...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cronie
Version: 7.3
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Tomas Mraz
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
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:
Environment:
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)?
no


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


10. List any affected packages or components.
cronie-1.4.11-17.el7.x86_64


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

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

"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 
rootfiles-8.1-11.el7.noarch

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
bash-4.2.46-29.el7_4.x86_64

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.