add script to load and unload module
This commit is contained in:
		
					parent
					
						
							
								ec746f51ab
							
						
					
				
			
			
				commit
				
					
						388077ca79
					
				
			
		
					 1 changed files with 19 additions and 0 deletions
				
			
		
							
								
								
									
										19
									
								
								linux/t_rmmod_modprobe_loop.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										19
									
								
								linux/t_rmmod_modprobe_loop.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,19 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					# Nico Schottelius
 | 
				
			||||||
 | 
					# Script to test if a module can be reloaded
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mod="$1"; shift
 | 
				
			||||||
 | 
					cmd="$1"; shift
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					while true; do
 | 
				
			||||||
 | 
					   loaded=$(lsmod | grep ^${mod})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   if [ "$loaded" ]; then
 | 
				
			||||||
 | 
					      rmmod -v "$mod"
 | 
				
			||||||
 | 
					   else
 | 
				
			||||||
 | 
					      modprobe -v "$mod"
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   
 | 
				
			||||||
 | 
					   $cmd
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue