AIX Crontab NULLED

aanya247
aanya247 used Ask the Experts™
on
As root on an AIX server a user ran a command "crontab" and pressed enter. As soon after he did this he did a "Ctrl z", This seems to have nulled the root crontab file. Is this possible, What is the explanation behind this.

I replicated the issue on a different server but root crontab entries were intact. So just by running "crontab" will this null the file, as I know that "crontab -e" does editing of crontab, "-e" option was not specified.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
$ crontab
[1] + Stopped (SIGTSTP)        crontab
Most Valuable Expert 2013
Top Expert 2013
Commented:
crontab alone opens an empty file for editing. Upon exit this file overwrites the original crontab.

ctrl-z alone cannot null a file. The user must have issued a write command, such as ":wq" or ":x" or "ZZ".

Could it be that it wasn't "ctrl-z" but "shift-zz"?
Dave GouldOnsite Support
Commented:
ctrl-z just suspends the vi process. If the user types "jobs" he should see that the process is still there and can bring it back to the foreground by typing fg.
This should bring him back to the vi process which he can simply force quit (:q!)

It is possible that this advice is a bit late if the user has already logged out.
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Author

Commented:
Its Too late now... :) thank you that is something which I did not think.
Most Valuable Expert 2013
Top Expert 2013

Commented:
ctrl-z alone will never destroy a file, I keep telling you.

Test: Issue "crontab", then hit ctrl-z, then issue "exit" twice.
Log in again and you will find the crontab unchanged.

And are you aware that "crontab -r" will delete the crontab without asking for confirmation?

Author

Commented:
Wmp
Ur solutions are very valuable and I learn a lot from them, I understood from the first comment that Ctrl Z, will not delete but I never knew that jobs is a command that can be run to find out.

So I am sorry for the distribution of points and I know that ur first comment solved my question .

Thanks again
Aanya
Most Valuable Expert 2013
Top Expert 2013

Commented:
Never mind, I'm always glad to help, regardless of the points.

Thx for them!

wmp

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial