HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- bkup script
Operating System - HP-UX
        1839829
        Members
    
    
        3088
        Online
    
    
        110156
        Solutions
    
Forums
        Categories
Company
Local Language
                
                  
                  back
                
        
                
        
                
        
                
        
        
        
                
        
                
        
        
        
                
        
              
              Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
                
                  
                  back
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
            
                
            
                
            
                
            
                
            
            
                
            
                
            
            
                
            
                
              
            Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
        Information
        Community
Resources
Community Language
        Language
        Forums
Blogs
	
		
			
            
                
            Go to solution
        
            
		
		
			
            	
	
		
        
		
	
	
		Topic Options
			
				
					
	
			
		
	- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2004 03:40 PM
05-12-2004 03:40 PM
			
				
					
					
						Hello All,
I have a working backup script just access for only one system when I do cront backup. Would you help me to have a variable set in the script that can work / apply for other system when I have a variable defined on crontab command! Thank you
 
This is a cront bkup command:
Ex. 0 0 * * 6 /70gig/ASI/bkscript_ravenp3 (I would like to have the ravenp3 (is a hostname) to be a variable that can apply for any system hostname when I run the script)
 
 
This is the script
  
#! /bin/ksh
# File: /70gig/ASI/bkscript_ravenp3
# Purpose: save all files & directories under directory /usr/ferrari, /usr/local/si,
# /usr/local/si_log, /usr/local/bin
DATE="`date`"
#SYS_NAME="ravenp3"
DESTFILE="/70gig/ASI/ravenp3/ravenp3.bk.tar"
ERROR="/70gig/ASI/error.logs"
MOUNT1="/backup_si"
MOUNT2="/backup_ferrari"
BKLOGS="/70gig/ASI/bk.logs"
# check error.log file for network no connection.
if
ping ravenp3 -n 3 | grep '3 packets transmitted, 3 packets received, 0% packet loss'
then
echo "$DATE; the system is connecting \n " >> $ERROR
else
echo "$DATE; the system is NO connecting \n " >> $ERROR
exit
fi
# check the system is mounting to the previuos system, so it needs to umount the previous syst before
# mount to the system.
if bdf | grep $MOUNT1
bdf | grep $MOUNT2
then
echo "$DATE; filesystem already mount to the previous system \n " >> $ERROR
umount $MOUNT1
umount $MOUNT2
echo "$DATE filesystem already Un-mount \n " >> $ERROR
fi
# mounting nft then tar & gzip the bkup files, finaly umount nfs
mount -F nfs ravenp3:/usr/local $MOUNT1
mount -F nfs ravenp3:/usr/ferrari $MOUNT2
tar -cvf $DESTFILE $MOUNT1/si $MOUNT1/si_logs $MOUNT1/bin $MOUNT2
/usr/contrib/bin/gzip -f $DESTFILE
umount $MOUNT1
umount $MOUNT2
echo "This is a bkscrip for ravenp3 on `date` \n " >> $BKLOGS
	
			
				
		
			
			
			
			
			
			
		
		
		
	
	
	
I have a working backup script just access for only one system when I do cront backup. Would you help me to have a variable set in the script that can work / apply for other system when I have a variable defined on crontab command! Thank you
This is a cront bkup command:
Ex. 0 0 * * 6 /70gig/ASI/bkscript_ravenp3 (I would like to have the ravenp3 (is a hostname) to be a variable that can apply for any system hostname when I run the script)
This is the script
#! /bin/ksh
# File: /70gig/ASI/bkscript_ravenp3
# Purpose: save all files & directories under directory /usr/ferrari, /usr/local/si,
# /usr/local/si_log, /usr/local/bin
DATE="`date`"
#SYS_NAME="ravenp3"
DESTFILE="/70gig/ASI/ravenp3/ravenp3.bk.tar"
ERROR="/70gig/ASI/error.logs"
MOUNT1="/backup_si"
MOUNT2="/backup_ferrari"
BKLOGS="/70gig/ASI/bk.logs"
# check error.log file for network no connection.
if
ping ravenp3 -n 3 | grep '3 packets transmitted, 3 packets received, 0% packet loss'
then
echo "$DATE; the system is connecting \n " >> $ERROR
else
echo "$DATE; the system is NO connecting \n " >> $ERROR
exit
fi
# check the system is mounting to the previuos system, so it needs to umount the previous syst before
# mount to the system.
if bdf | grep $MOUNT1
bdf | grep $MOUNT2
then
echo "$DATE; filesystem already mount to the previous system \n " >> $ERROR
umount $MOUNT1
umount $MOUNT2
echo "$DATE filesystem already Un-mount \n " >> $ERROR
fi
# mounting nft then tar & gzip the bkup files, finaly umount nfs
mount -F nfs ravenp3:/usr/local $MOUNT1
mount -F nfs ravenp3:/usr/ferrari $MOUNT2
tar -cvf $DESTFILE $MOUNT1/si $MOUNT1/si_logs $MOUNT1/bin $MOUNT2
/usr/contrib/bin/gzip -f $DESTFILE
umount $MOUNT1
umount $MOUNT2
echo "This is a bkscrip for ravenp3 on `date` \n " >> $BKLOGS
Solved! Go to Solution.
		3 REPLIES 3
	
	            
            
		
		
			
            
                - Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2004 06:14 PM
05-12-2004 06:14 PM
Solution
			
				
					
					
						I might be being a bit simple here but it looks like you are backing up by NFS mounting the required filesystems from a machine and then using tar.
 
If this is all you want, then the solution to your problem is really simple.
 
Replace the string "ravenp3" with "$1" thougout the script. Then call the scripts as
"bkscript_ravenp3".  If this does do what you need then it might be worth renaming the script to just "bkscript" 
					
				
			
			
				
		
		
	
	
	
If this is all you want, then the solution to your problem is really simple.
Replace the string "ravenp3" with "$1" thougout the script. Then call the scripts as
"bkscript_ravenp3
	Never preceed any demonstration with anything more predictive than "watch this"
			
			
				
			
			
			
			
			
			
		- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 11:05 AM
05-13-2004 11:05 AM
			
				
					
						
							Re: bkup script
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Hello Mark,
Thank you for help, you give me the solution; you are a life saver. I got it work now :o).
Thanks again
Jen
		
		
	
	
	
Thank you for help, you give me the solution; you are a life saver. I got it work now :o).
Thanks again
Jen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 02:52 PM
05-13-2004 02:52 PM
			
				
					
						
							Re: bkup script
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Great answer Mark.  Sounds like you are all set Jennifer, but thought I'd throw in my 2 cents.  You asked about a variable to use for your hostname.  You could use $(uname -n) to print the machine's hostname.  This would replace ravenp3 (your hostname that's hardcoded in your script) with the hostname that is being backed up.
Any rate, glad you got your script working.
		
		
	
	
	
Any rate, glad you got your script working.
	Together We Stand!
			
			
				
			
			
			
			
			
			
		The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
		
	
	
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP
