Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 2 of 2

This is a discussion on Shell backup script help in the Shared & Semi-Dedicated forum
I have not written many shell scripts before. I'm wanting to write a scripts to backup my site to a tar.gz file with date and ...

  1. #1
    JPC Addict randyriegel's Avatar
    Join Date
    Jan 2002
    Location
    Wintersville, OH
    Posts
    161

    Shell backup script help

    I have not written many shell scripts before. I'm wanting to write a scripts to backup my site to a tar.gz file with date and time in filename.

    I can back up my files with the following command:

    tar -zcvf backup20040726_1300.tar.gz mydir

    I want to create a script automatically puts the current date and time in this command. How can this be done. I'm sure it's probably pretty easy I'm just not experienced at shell scripting.

  2. #2
    JPC Addict randyriegel's Avatar
    Join Date
    Jan 2002
    Location
    Wintersville, OH
    Posts
    161
    nevermind figured it out using

    Code:
    FILE=~/backups/backup_$(date + %Y%m%d_%k%M).tar.gz
    tar -zcvf $FILE mydir

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •