-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make a backup of the crontab file on edition and deletion #128
Conversation
This is a nice idea however I'd like to see it a little bit more general - i.e., backup the previous user's crontab any time a writing to a crontab happens. Also the backup file should be placed somewhere in the home directory - I assume $(XDG_CACHE_HOME)/crontab.backup (if XDG_CACHE_HOME is set) and $HOME/.cache/crontab.backup otherwise. |
8d65772
to
3f029a6
Compare
I think that should be good ! |
5eabf8c
to
8589910
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final nits. Plus we need the username from -u in the backup file name and also some documentation in the crontab(1) manpage.
(void) fclose(crontab_file); | ||
(void) fclose(backup_file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the space between the cast and function name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other instances of (void)
have a space, for example :
Line 348 in 32bced4
(void) strcpy(Host, argv[optind]); |
Are you sure ?
Sure! Sorry for all these basic mistakes, it's my first time contributing C code (I know I still have to add documentation to the man, I'll do that when I get time) |
f395088
to
cfa03c4
Compare
Do you want me to clean the commit tree with an interactive rebase, before integrating them in master ? |
Yes, please squash the commits to single one with some descriptive commit message. |
27f12d5
to
45a62cf
Compare
Perfect. Merging. |
Thanks for being patient with me |
This is failing on systems where $XDG_CACHE_HOME or $HOME/.cache doesn't exist yet. Should the pull request to fix this create the .cache folder where it doesn't exist, or disable the backup when it doesn't exist? I'm leaning towards creating .cache where missing, rather than failing. |
This was reported as #173 Creating a .cache would be fine IMO. |
This will help users that mistakenly run
crontab -r
, by providing a way to restore the crontab fileA bit related to #12