LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 04-26-2012, 06:10 AM   #1
WoAnerges
Member
 
Registered: Apr 2012
Posts: 50

Rep: Reputation: Disabled
Question backup script question. Thank you for your help!


Hey guys,

so, I want this kind of script to get working, but I don't know, how to make it happen.



Code:
#!/bin/sh
tar czvfsp bak-$(date +%Y%m%d-%H).tgz /dir1/dir1a
mv /dir1/bak-$(date +%Y%m%d-%H).tgz /dir2/bak-$(date +%Y%m%d-%H).tgz
exit $?
Well, I don't think, this script is correct, but how to make such kind of a script?

Thank you!
 
Old 04-26-2012, 06:18 AM   #2
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,159

Rep: Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364Reputation: 1364
why do you think it is not correct? What is the problem with it?
I suggest you to use a variable for the filename:
Code:
#!/bin/sh
FILENAME=bak-$(date +%Y%m%d-%H).tgz
tar czvfsp $FILENAME /dir1/dir1a
mv /dir1/$FILENAME /dir2/$FILENAME
exit $?
 
1 members found this post helpful.
Old 04-26-2012, 06:19 AM   #3
WoAnerges
Member
 
Registered: Apr 2012
Posts: 50

Original Poster
Rep: Reputation: Disabled
Lightbulb

AWESOME!
This is what I need!
Thanks, mate.
 
  


Reply

Tags
backup, bash, script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Incremental backup script question drsprite Linux - Software 2 05-19-2011 02:08 PM
Newbie trying to write a simple backup script to backup a single folder Nd for school stryker759a Linux - Newbie 2 09-16-2009 09:52 AM
how to create backup MYSQL Script to backup my database for every 1hour RMLinux Linux - Newbie 3 11-20-2008 11:13 AM
backup script question lordofring Linux - Software 7 04-18-2005 11:25 AM
Backup script question ! emailssent Programming 7 12-02-2004 08:43 PM


All times are GMT -5. The time now is 10:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration