ubuntu - Bash Script to Check That Files Are Being Created -



ubuntu - Bash Script to Check That Files Are Being Created -

we have amazon ec2 instance upload output our security cameras. every , then, cameras have issue, stop uploaded, , need rebooted. easy way determine seeing if files not beingness created. problem creates lots , lots of files. if utilize find -ctime, takes long time script run. there faster way check see if files have been created since yesterday? need capture result, (yes there files, or not there not,) , email message, nice have didn't take half hr run.

#!/bin/bash find /vol/security_ftp/west -ctime -1 find /vol/security_ftp/backentrance -ctime -1 find /vol/security_ftp/boardroomdoor -ctime -1 find /vol/security_ftp/mainentrance -ctime -1 find /vol/security_ftp/north -ctime -1 find /vol/security_ftp/south -ctime -1

using find natural solution, if must avoid it, can see newest file in directory using ls , sorting output according ctime, eg.

ls /vol/security_ftp/west -clt | head --lines=1

this plenty if want see date. if need improve formatted output (or ctime process further) can feed filename stat:

stat --format="%z" $( ls /vol/security_ftp/west -ct | head --lines=1 )

this not reply automatically if file created recently, though.

bash ubuntu

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -