Skip to main content

The find supposecommand is supposed to return several files, hence the warning you see.

If you want check one file, it would be better to use stat

file_btime=$(stat -c%W /var/opt/test/maintenancelock/testLOCK) time_now=$(date %s) file_age=$(( time_now - file_btime )) if [ $file_age -le 86400]86400 ] ; then echo File is less then 24h old fi 

The find suppose to return several files, hence the warning you see.

If you want check one file, it would be better to use stat

file_btime=$(stat -c%W /var/opt/test/maintenancelock/testLOCK) time_now=$(date %s) file_age=$(( time_now - file_btime )) if [ $file_age -le 86400] ; then echo File is less then 24h old fi 

The find command is supposed to return several files, hence the warning you see.

If you want check one file, it would be better to use stat

file_btime=$(stat -c%W /var/opt/test/maintenancelock/testLOCK) time_now=$(date %s) file_age=$(( time_now - file_btime )) if [ $file_age -le 86400 ] ; then echo File is less then 24h old fi 
edited body
Source Link
White Owl
  • 5.3k
  • 1
  • 9
  • 16

The find suppose to return several files, hence the warning you see.

If you want check one file, it would be better to use stat

file_ctime=$file_btime=$(stat -c%W /var/opt/test/maintenancelock/testLOCK) time_now=$(date %s) file_age=$(( time_now - file_ctimefile_btime )) if [ $file_age -le 86400] ; then echo File is less then 24h old fi 

The find suppose to return several files, hence the warning you see.

If you want check one file, it would be better to use stat

file_ctime=$(stat -c%W /var/opt/test/maintenancelock/testLOCK) time_now=$(date %s) file_age=$(( time_now - file_ctime )) if [ $file_age -le 86400] ; then echo File is less then 24h old fi 

The find suppose to return several files, hence the warning you see.

If you want check one file, it would be better to use stat

file_btime=$(stat -c%W /var/opt/test/maintenancelock/testLOCK) time_now=$(date %s) file_age=$(( time_now - file_btime )) if [ $file_age -le 86400] ; then echo File is less then 24h old fi 
Source Link
White Owl
  • 5.3k
  • 1
  • 9
  • 16

The find suppose to return several files, hence the warning you see.

If you want check one file, it would be better to use stat

file_ctime=$(stat -c%W /var/opt/test/maintenancelock/testLOCK) time_now=$(date %s) file_age=$(( time_now - file_ctime )) if [ $file_age -le 86400] ; then echo File is less then 24h old fi