HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: help script .. make soft link
Operating System - Linux
        1839860
        Members
    
    
        2937
        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
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
09-21-2006 06:19 PM
09-21-2006 06:19 PM
			
				
					
						
							help script .. make soft link
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Hi all
that you gave tips are very helpful.
can I have your tips for script.
we have a problem.
Sometimes
some links are removed abruptly.
so some web services are bad in state.
[root@web apps]# ll
total 0
lrwxrwxrwx 1 root root 14 Sep 21 13:54 portal -> /nasnew/portal
[root@web apps]# pwd
/opt/FJSVj2ee/var/deployment/ijserver/portal/apps
as you see portal has been removed..
so
I want to have some scripts to make soft link when it is removed
the script will be cron service , for every 1 minute.
Any help will be fine.
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
that you gave tips are very helpful.
can I have your tips for script.
we have a problem.
Sometimes
some links are removed abruptly.
so some web services are bad in state.
[root@web apps]# ll
total 0
lrwxrwxrwx 1 root root 14 Sep 21 13:54 portal -> /nasnew/portal
[root@web apps]# pwd
/opt/FJSVj2ee/var/deployment/ijserver/portal/apps
as you see portal has been removed..
so
I want to have some scripts to make soft link when it is removed
the script will be cron service , for every 1 minute.
Any help will be fine.
		2 REPLIES 2
	
	            
            
		
		
			
            
                - Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2006 10:21 PM
09-21-2006 10:21 PM
			
				
					
						
							Re: help script .. make soft link
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						You wrote: "as you see portal has been removed.."
I don't think it's possible to see from your post what was removed.
Below is the solution in Perl (I don't have linux console to check the shell's solution):
#!/usr/bin/perl
$link = "path_to_some_link";
unless ( -l $link) {
symlink(OLDFILE,NEWFILE); #Creates a new filename symbolically linked to the old filename.
}
If you have several links to check - put them all in array and run the unless statement for every member of array.
Best in your situation would be to check the cause for links removal and to eliminate it.
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
I don't think it's possible to see from your post what was removed.
Below is the solution in Perl (I don't have linux console to check the shell's solution):
#!/usr/bin/perl
$link = "path_to_some_link";
unless ( -l $link) {
symlink(OLDFILE,NEWFILE); #Creates a new filename symbolically linked to the old filename.
}
If you have several links to check - put them all in array and run the unless statement for every member of array.
Best in your situation would be to check the cause for links removal and to eliminate it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2006 05:39 PM
09-23-2006 05:39 PM
			
				
					
						
							Re: help script .. make soft link
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Sobetter is to try investigate why exactly link is removed,but do following if you want only recreate link:
run
crontab -e
add folloving line
* * * * * ln -s /opt/FJSVj2ee/var/deployment/ijserver/portal/apps/portal /nasnew/portal
		
		
	
	
	
run
crontab -e
add folloving line
* * * * * ln -s /opt/FJSVj2ee/var/deployment/ijserver/portal/apps/portal /nasnew/portal
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
