I thought of using watch command to delete files in a directory every N seconds with the command running in background.
This is what I was planning to use:
nohup watch -n1200 rm -rf /var/log/radius/radacct/188.8.131.52/detail-2013* &
It works, but when I see the running process, it shows me the following output -
[root@Free-Radius 184.108.40.206]# ps -aef | grep watch root 27326 10649 0 15:23 pts/0 00:00:00 watch -n1200 rm -rf /var/log/radius/radacct/220.127.116.11/detail-20130816 root 27404 10649 0 15:24 pts/0 00:00:00 grep watch
Now there will be a new file
detail-20130817 tomorrow, which will not get deleted. Is there a way to achieve it using watch command. I know its easily doable using a simple bash script or cron job, but just wanted to know if it can be done using watch.