Which command is used for checking if file is not open in linux? -
lsof command used fot open files in linux.which command used checking if file not open.i want utilize in script
my status
do if [[ 'lsof | grep $r_error_file' ]] error_text=$error_text$(tail -n +1 $r_error_file | grep 'error\') mv $r_error_file $(dirname ${r_error_file})/bkerror/$(filename ${r_error_file}) fi done
use fuser command
fuser $filename if [ $? ne 0 ] # file open, add together code here fi linux
No comments:
Post a Comment