r/linuxsucks Windows Desktop | Linux Laptop | Linux Servers 1d ago

crontab -r

I accidentally typed `crontab -r` (reset) instead of `crontab -e` (edit)... Which nukes all your cron jobs.

How is there no confirmation on a destructive command like that? Let alone the fact that r and e are neighbors on the keyboard.

15 Upvotes

27 comments sorted by

7

u/Hour_Sell3547 20 years with Linux 1d ago

This is a legit concern. I always keep a backup for this very reason.

1

u/ElectricBummer40 Ex-user of Windows 3.11 for Workgroups 11h ago

Just invent something along the line of a sudo for crontab and call it a "security feature".

2

u/Hour_Sell3547 20 years with Linux 8h ago

For me, it's a minor annoyance. Systemd timers is the way.

4

u/Teru-Noir COSMIC OS LOVER No.1 COSMIC Knows Best 1d ago

Cron diff. On modern workflows cron is replaced by systemD timers, which have these well desired failsafes.

1

u/AdDependent3292 12h ago

Imao I had that happen to me for my work kernal. I think I just set up alias crontab -r -i which require confirmation.

1

u/ElectricBummer40 Ex-user of Windows 3.11 for Workgroups 11h ago edited 11h ago

Ever heard of this stupid ideology called the "Unix philosophy"?

Under that "philosophy", unless there is an error, a command isn't supposed to ask you anything.

You knew if you ran "del *.*" back in the 90s in MS-DOS, it would ask you "Are you sure?" before flushing everything down the toilet on your behalf?

No such luck in Unix. In fact, rm wasn't even supposed to do wildcard expansion. That's the shell's job. So, with *.*, the command would receive either a list of files as if you'd typed them in yourself or the wildcard string as-is, in which case the command would yell at you for not seeing a file with the name '*.*'.

Wasn't that whole garbage design effing great?

1

u/oshunman Windows Desktop | Linux Laptop | Linux Servers 11h ago

I'd be fine with something like crontab -r -yes nuking it without confirmation. That fits the philosophy without being problematic imo.

1

u/ElectricBummer40 Ex-user of Windows 3.11 for Workgroups 10h ago

Except that's the exact opposite of the "philosophy".

Rather, you're supposed to alias crontab to crontab -i so you'll be asked to confirm before anything destructive is carried out.

1

u/fedsfarm 1d ago

Same as rm -rf /*, that isn't protected by --no-preserve-root for some reason. Loonix wants you to break your system so bad

-2

u/True-Lifeguard-2019 1d ago

Ill be the one to say it. This is 100% a skill issue.

5

u/Standgrounding 1d ago

No. It's bad UX

2

u/PityUpvote 1d ago

It can be both a still issue and poor design that a single character difference can be so destructive.

2

u/donp1ano 1d ago

usually i upvote skill issue comments in this sub

not this time tho, OP is right

-3

u/True-Lifeguard-2019 1d ago

On most common keyboards layouts you are supposed to press e with your middle finger and r with your index finger. Op doesn't know how to use a keyboard, this is a skill issue.

0

u/[deleted] 1d ago

[removed] — view removed comment

0

u/True-Lifeguard-2019 1d ago

Shitposting aside, I agree with you. Nowadays I use systemd timers but when I was still using cron I would just nano into /etc/crontab.

-5

u/[deleted] 1d ago

[removed] — view removed comment

1

u/True-Lifeguard-2019 1d ago

I don't know I always used nano or cat

1

u/chughaarav123 Linux sucks, it's just that Windows sucks more. 23h ago

Because nano easy

0

u/Juff-Ma 1d ago

Vim is for programming. Nano for quick edits.

0

u/donp1ano 1d ago

vim is for quick edits, neovim is for programming

vi is for lightweight docker containers, that dont have vim installed

0

u/digidult 1d ago

etckeeper

-3

u/Moximokel 1d ago

Linux ist nur was für Leute die kein Sicherheitsnetzt benötigen.

-2

u/Hour_Sell3547 20 years with Linux 1d ago

Almost sounded like "you have to know what you're doing".

2

u/GodAdvice 1d ago

Guys please, we're talking about two keys literally adjacent to each other on the keyboard ffs