LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-27-2009, 05:18 PM   #1
thesnaggle
Member
 
Registered: Sep 2003
Distribution: Fedora
Posts: 52

Rep: Reputation: 15
scripting questions


I have a backup script that i wrote a while back that goes to different pcs on my network.

everything works good but i have since added a laptop that is not always here is there anyway that i can setup my script that if the laptop is not here that the old data that was backed up when the laptop was here not to be destroyed
 
Old 02-27-2009, 05:35 PM   #2
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
So you are deleting the previous backups on each successful run, but want to preserve the laptop's if it is not on the network, and not able to be backed up?

Maybe try to ping for it in your script? If no response, then no deletion?
 
Old 02-27-2009, 05:40 PM   #3
thesnaggle
Member
 
Registered: Sep 2003
Distribution: Fedora
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by TBC Cosmo View Post
So you are deleting the previous backups on each successful run, but want to preserve the laptop's if it is not on the network, and not able to be backed up?

Maybe try to ping for it in your script? If no response, then no deletion?
that is my plan but im not exactly sure on how to tell my script to do what i want
 
Old 02-27-2009, 05:53 PM   #4
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
Ok, so I guess that you need to test for the existence of the laptop on the network to decide whether to do the backup and delete the old.

Code:
if ping -c 3 w.x.y.z >/dev/null 2>&1
then
    backup-routine
    delete-previous-routine
fi
 
Old 02-27-2009, 06:01 PM   #5
thesnaggle
Member
 
Registered: Sep 2003
Distribution: Fedora
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by TBC Cosmo View Post
Ok, so I guess that you need to test for the existence of the laptop on the network to decide whether to do the backup and delete the old.

Code:
if ping -c 3 w.x.y.z >/dev/null 2>&1
then
    backup-routine
    delete-previous-routine
fi
this is a big help and i think that it will get me to where i want to be thanks for the help and i may post again if i get stuck thanks again
 
Old 02-27-2009, 06:13 PM   #6
thesnaggle
Member
 
Registered: Sep 2003
Distribution: Fedora
Posts: 52

Original Poster
Rep: Reputation: 15
one more question how do i tell it which one to use i made a test script and it runs both my scripts i have put in
 
Old 02-27-2009, 06:28 PM   #7
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
You want to run both routines if the laptop is there. Otherwise that whole thing is skipped if it's not available. The end result is that when on the network - the laptop gets backed up and the previous backup is discarded. If it is not, then the script skips and moves on to backup the other machines.
 
  


Reply


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
shell scripting questions tlarkin Programming 8 05-11-2007 03:49 PM
Questions about scripting custangro Solaris / OpenSolaris 3 04-17-2007 06:09 PM
Bash scripting questions stryka Programming 3 11-24-2005 11:46 PM
a few scripting questions w/X promark Linux - Software 1 07-15-2004 12:34 AM
Bash scripting questions irfanhab Programming 2 06-07-2004 12:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:35 PM.

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
Open Source Consulting | Domain Registration