Sponsored Content
Top Forums Shell Programming and Scripting Script for taking backup of desktop files. Post 302516353 by paragnehete on Friday 22nd of April 2011 04:54:27 PM
Old 04-22-2011
I made this script......



Code:
#! /bin/bash
 
# Variables
location=/home/dr/parag.n/Desktop
directory=*
backuplocation=/home/dr/parag.n
log=/home/dr/parag.n/backup.log
 
echo -e “\nBackup started: `date`” >> $log
 
if [ -d $backuplocation ]; then
 
mkdir -p $backuplocation/`date +%y-%m-%d`
cd $location
tar -zcvf $backuplocation/`date +%y-%m-%d`/Desktop-Files.`date  +%H-%M-%S`.tar.gz $directory
rm -fr *
echo ” completed: `date`” >> $log
mv $log $backuplocation/backup.log
echo -e “\n — Backup completed –\n”;
else
echo ” FAILED: `date`” >> $log
echo -e “\n– WARNING: –”
echo -e “– BACKUP FAILED –\n”;
fi



In this "parag.n" is my home directory. But I have many users. How can i take backup of all of them? & How could i get a mail after finishing backup?

Moderator's Comments:
Mod Comment Please use [CODE] tags when posting listings, ...

Last edited by pludi; 04-23-2011 at 09:31 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Taking System Backup

Hello Guys: Would like to know how to take an entire system backup.. Here is the entire scenario.. I am working on a system that is AIX RS6000 M80 Server. We have loaded the OS and installed all the patches and then we took an entire system backup. We also verified by restoring the same... (2 Replies)
Discussion started by: ST2000
2 Replies

2. Shell Programming and Scripting

taking backup en getting info about it

I want to write a script that tells me if the tape device is ready, if the answer is not yes ($?is not 0) i get an answer that the tape_device is not ready. If the tape is ready i can do a tar -cvf $tape1 * . How can i write a script to control if the tapedevice is ready or not? How can i... (1 Reply)
Discussion started by: eddyvdv
1 Replies

3. UNIX for Advanced & Expert Users

Showing Device Does Not Exist While Taking Backup

Friends, while taking backup on /dev/rmt/0cn it is showing device does not exists. I have checked /dev/rmt 0cn is present there with link file created in /devices/pci@8,700000/scsi@5/st@5,0:cn I have checked cd /devices/pci@8,700000/scsi@5 but st@5,0:cn is not there. But I found st@3,0:cn. ... (3 Replies)
Discussion started by: ailnilanjan
3 Replies

4. Shell Programming and Scripting

Script to Backup files

Hi, I wrote a simple script to backup of index.php and index.html in my box. So, I wrote a script which take a copy of the index page as 1Mar09: but it does not comes up.. #! /bin/bash find . -name index.* > domains.txt for i in `cat domains.txt` ; do cp index* index*.1Mar09 $i; done But... (6 Replies)
Discussion started by: gsiva
6 Replies

5. Shell Programming and Scripting

script compare files and backup

Im working on a shell script that uses three parameters, a string to replace, the string replacing, and a file name. In this script it makes a back up file before the replacement occurs. However I want to be able to either search the file to see if it has the string and if it doesnt dont create... (5 Replies)
Discussion started by: gordonheimer
5 Replies

6. HP-UX

Temp folder Getting full while taking backup.

Hi Experts, When i taking backup of my servers in Tape Library simultaneously the Temp folder is getting full...... these file like OB2DBG*.txt (2 Replies)
Discussion started by: purushottamaher
2 Replies

7. Shell Programming and Scripting

Backup script to split and tar files

Hi Guys, I'm very new to bash scripting. Please help me on this. I'm in need of a backup script which does the ff. 1. If a file is larger than 5GB. split it and tar the file. 2. Weekly backup file to amazon s3 using s3rsync 3. If a file is unchanged it doesn't need to copy to amazon s3 ... (4 Replies)
Discussion started by: ganitolngyundre
4 Replies

8. Shell Programming and Scripting

Script to delete files older than x days and also taking an input for multiple paths

Hi , I am a newbie!!! I want to develop a script for deleting files older than x days from multiple paths. Now I could reach upto this piece of code which deletes files older than x days from a particular path. How do I enhance it to have an input from a .txt file or a .dat file? For eg:... (12 Replies)
Discussion started by: jhilmil
12 Replies

9. Shell Programming and Scripting

Script or alias to backup all files opened by vi

we want to backup all opened files by vi before editing also with version information. i wrote below alias to backup crontab file content with version info. What i want know is to make this opened files by vi. We want to prevent user mistakes by adding this alias. alias crontab='DATE=$(date... (4 Replies)
Discussion started by: sebu
4 Replies

10. AIX

Script to remove backup files

HI, I want to remove my backup files keeping last 30 days. Now i am doing it manually. Does anyone have a script to automate this process? Thanks in advance (5 Replies)
Discussion started by: ElizabethPJ
5 Replies
xdg-user-dir(1) 						   User Commands						   xdg-user-dir(1)

NAME
xdg-user-dir - Get the path used for desktop user directory location. SYNOPSIS
xdg-user-dir DIR DESCRIPTION
xdg-user-dir is a utility that extracts the location of the specified desktop user directory from the file : ${HOME}/.config/user-dirs.dirs OPERANDS
Valid desktop directories (DIR) are: DESKTOP DOWNLOAD TEMPLATES PUBLICSHARE DOCUMENTS MUSIC PICTURES VIDEOS If an invalid directory is requested ${HOME} is returned. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: HOME. Other environment variable that are used are: XDG_CONFIG_HOME Base directory for storge of XDG configuration files. Defaults to ${HOME}/.config FILES
The following files are used by this application: /usr/bin/xdg-user-dir XDG Directory expansion utility. ${XDG_CONFIG_HOME}/user-dirs.dirs Location of the user-specific configuration including the current list of directories and what they map to. EXAMPLES
Example 1: Location of user's documents directory % xdg-user-dir DOCUMENTS /home/user/Documents ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWxdg-user-dirs | +-----------------------------+-----------------------------+ |Interface stability |Uncommitted | +-----------------------------+-----------------------------+ SEE ALSO
More information can be found at: http://www.freedesktop.org/wiki/Software/xdg-user-dirs xdg-user-dirs-update(1), xdg-user-dirs-gtk-update(1), attributes(5) NOTES
Written by Darren Kenny, Sun Microsystems Inc, 2008 SunOS 5.11 03 Apr 2008 xdg-user-dir(1)
All times are GMT -4. The time now is 05:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy