root detection functions
This commit is contained in:
		
							parent
							
								
									aab99cccc1
								
							
						
					
					
						commit
						c1ed52ede0
					
				@ -26,6 +26,23 @@ show_ssh_hosts () {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					is_root () {
 | 
				
			||||||
 | 
						echo "test root"
 | 
				
			||||||
 | 
						echo "$(id -u)"
 | 
				
			||||||
 | 
					    return $(id -u)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					remote_update () {
 | 
				
			||||||
 | 
						echo $1
 | 
				
			||||||
 | 
					ssh $1 << EOF
 | 
				
			||||||
 | 
					# date
 | 
				
			||||||
 | 
					# hostname
 | 
				
			||||||
 | 
					# cat /etc/resolv.conf
 | 
				
			||||||
 | 
					 $(typeset -f is_root)
 | 
				
			||||||
 | 
					 is_root
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#for i in "${targets[@]}"
 | 
					#for i in "${targets[@]}"
 | 
				
			||||||
#do
 | 
					#do
 | 
				
			||||||
#   :
 | 
					#   :
 | 
				
			||||||
@ -72,6 +89,7 @@ elif [ "$((HOST-OFFSET_OPTIONS))" -gt 7 ]; then
 | 
				
			|||||||
else
 | 
					else
 | 
				
			||||||
	index=$((HOST-OFFSET_OPTIONS))
 | 
						index=$((HOST-OFFSET_OPTIONS))
 | 
				
			||||||
	echo "${TARGETS[$index]}"
 | 
						echo "${TARGETS[$index]}"
 | 
				
			||||||
 | 
						remote_update "${TARGETS[$index]}"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user