I tried to understand the code but I have some difficulties in it.
crontab -e is crontab schedule formatpm 9pm at night every Sunday, but it seem to me it is encrypted.  Can any one explain it?

Crontab -e 0 21 * * 0 zip -P passw0rd -r /var/backup/secure.zip /home/$USER >/dev/null 2>&1
  • I tried to understand the code but I have some difficulties .... this does not describe the difficulties in any way ........ what are you trying to accomplish? – jsotola Apr 10 '19 at 1:06
  • something like 2>&1 what does it mean and also /dev/null and also $USER i understand that the code wile make schedule -p pass0rd it is optional /var/backup/secure.zip here it it means we make new file called secure.zip – user346408 Apr 10 '19 at 1:17
  • 1
    What exactly is your question? How to make secure backup in Ubuntu Linux or to understand the command mentioned in your post? For the first one, there are lots of answers, for the second one, just type man crontab. – Mike V.D.C. Apr 10 '19 at 5:10

The command crontab -e lets you edit your crontab and if you add the line 0 21 * * 0 zip -P passw0rd -r /var/backup/secure.zip /home/$USER >/dev/null 2>&1, save and exit your editor, then you have created a new entry that runs the command each Sunday at 9pm.

You can use crontab -l to display the content of your crontab on stdout without editing it.

The command creates a zip file /var/backup/secure.zip of the content of your home directory /home/$USER recursively (-r) and uses the password option -P passw0rd to encrypt it with password "passw0rd".

The >/dev/null 2>&1 at the end is used to prevent any output of the zip command to stdout and stderr to prevent cron from sending any mails (if successful or in the event of an error).

To unzip the zip file, you will have to enter the password if you use unzip secure.zip, or use unzip -P passw0rd secure.zip.

| improve this answer | |
  • 1
    How is this an answer??? – user5325 Apr 11 '19 at 10:13
  • @user5325 This is an answer explaining the crontab entry of the question and not "How to make a secure backup". In my opinion OP has chosen a bad title for the question. Is something wrong with the crontab explanation or why do I get the downvotes? – Freddy Apr 11 '19 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.