How can I export the contents of the crontab to a file?
I need it because I'm switching usernames and do not want to lose the data in the crontab.
crontab -e simply fires up the crontab file for that account in your default text editor so you can edit it. With nano, which is the default on ubuntu, you can hit ctrl-x then choose to save. From the comments :wq for Vim and C-x C-s to save and C-x C-c to exit for emacs.
Create the backup (export):
crontab -l > /some/shared/location/crontab.bak
Import it from the new user:
crontab /some/shared/location/crontab.bak
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With