Re: Pls help with little bash script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fajar Priyanto wrote:

Hi all,
I want to automate backup process into crontab.
What I usually manually do is:
tar zcvf filename-date.tar.gz /somedirectory

Can anyone help me with the script needed that can include the date in the filename?
Thanks.

Well just assign date to something and then use it.
Like:

OLDFILE = 'myfile.gz'
TODAY = `date +%F`
NEWFILE = $TODAY-$OLDFILE

mv $OLDFILE $NEWFILE


Cheers,
Mike


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux