linux - Shell Script to backup /etc/passwd every 6pm -
how can create cronjob create backup /etc/passwd every 6pm.
this should output:
passwd_<date>.tar.gz
i new in shell scripting, trying figure out. read cron , crontab, but, can't figure how create backup using shell script.. can me.. examples appreciated. in advance.
use crontab
option -e
directly edit cronjob:
crontab -e
the specification of cronjob is:
minute hour day month day-of-week command-line-to-execute
the following sets job run everyday @ 6:00 pm
0 18 * * * tar -czf passwd_`date | tr ' ' '_' | tr ':' '_'`.tar.gz /etc/passwd
the command can script, in case simple tar command. name of file formed calling date
command, converting spaces , colons underscores. creates filenames following:
passwd_sun_may__3_13_13_00_cdt_2015.tar.gz
Comments
Post a Comment