Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Looking to create a few basic scripts for a bsd machine

Thread Tools
 
Search this Thread
 
Old 09 September 2005, 12:33 PM
  #1  
Stueyb
Scooby Regular
Thread Starter
 
Stueyb's Avatar
 
Join Date: May 2002
Posts: 1,893
Likes: 0
Received 0 Likes on 0 Posts
Default Looking to create a few basic scripts for a bsd machine

Hi peeps,

Its years since I touched unix in any great depth but I now need to create 2 scripts Im hoping someone can help me with or where I can find one

Script 1
Basic Backup script

All it needs to do, at the moment is make a copy of a folder in /usr/home and then tar it together, gzip it and then move it to a web accessable folder for download, renaming the file to backup090905.tar.gz if poss.

Script 2
Rubbish deletion script.

Now this folder has several hundred folders and subfolders containing images. Some of them have *.bak and thumbs.db in them and over several hundred folders it mounts up. Im looking for a script to create a file so I can review it and then if if its all ok, delete it.

Anyone know whats required/where I can get one from. I have googled for it !

Cheers

Stu
Old 09 September 2005, 02:06 PM
  #2  
Vonzack
Scooby Regular
 
Vonzack's Avatar
 
Join Date: Jan 2004
Posts: 179
Likes: 0
Received 0 Likes on 0 Posts
Thumbs up

This info may not be 100%, I've been away from Unix for about 10 years, but if it doesn't work it'll be a starter for 10 for you ;-)

Script 1:

tar cf - 'find /usr/home' | gzip > <filename>

Script 2:

find <pathname> -name '*.bak' -exec rm {} \;
find <pathname> -name 'thumbs.db' -exec rm {} \;

Also this is a good link for command reference at www.linuxdevcenter.com/linux/cmd/
Old 09 September 2005, 07:47 PM
  #3  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Default

Solaris or some other non-GNU Unix? -z will compress with GNU tar:

$ tar cfz /path/to/shared/dir/backup`date +%y%m%d`.tar.gz /usr/home
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
02 July 2023 01:54 PM
Frizzle-Dee
Essex Subaru Owners Club
13
01 December 2015 09:37 AM
Sam Witwicky
Engine Management and ECU Remapping
17
13 November 2015 10:49 AM
Davalar
General Technical
19
30 September 2015 08:54 PM
lozgti1
Non Scooby Related
8
28 September 2015 03:49 AM



Quick Reply: Looking to create a few basic scripts for a bsd machine



All times are GMT +1. The time now is 08:44 PM.