To set up the cronjob for yr present non-root user, do in terminal:
$ crontab -e
The above will open yr (non-root) user's crontab
with his/her default editor.
Alternatively, to do so for the root crontab
, but with yr present (presumably non-root) user environment parameters (default editor, etc.):
$ sudo -i crontab -e
In yr opened crontab
, enter a new line:
0 01 01 * * /bin/tar -cvpz --exclude=/bckupftp --exclude=/ser --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys / | /usr/bin/split -d -b 750m - /bckupftp/backup$(/bin/date +\%Y\%m\%d-\%H\%M\%S).tar.gz
(I did not check the validity of yr tar
cmd.)
Note that:
crontab
uses a 24-hour clock, military style: 15
means 3pm, 03
means 3am, etc.
the above cron
entry runs at 01:00 o'clock the first day of every month. In terminal , do: man crontab
for more info on crontab formats.
in crontab
, it's a good habit to prefix cmds with their full path. To find the full path of any non-built-in cmd, do in terminal $ which <cmd>
. Thus the tar
cmd becomes /bin/tar
, split
becomes /usr/bin/split
, etc..
as soon as you save the newly edited crontab
, the cron
job becomes effective. No need to reboot, log out and back in, or restart whatever service.
when saving yr bckup file(s), the time stamp has the following format YYYYMMDD-HHMMSS. If you need it to be more precise, try replacing %S
with %s
in yr crontab
entry.
I am certain (meaning "with 100% probability") you can find all the above explained in great details in AU, SE at large as well as in other fora. Remember that StartPage is yr friend.
/dev
,/tmp
, and/run
as well. Backing up/boot
or/var
doesn't make a lot of sense either. – David Foerster Apr 24 '16 at 12:12