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/18.104.22.168/detail-2013* &
It works, but when I see the running process, it shows me the following output -
[root@Free-Radius 22.214.171.124]# ps -aef | grep watch root 27326 10649 0 15:23 pts/0 00:00:00 watch -n1200 rm -rf /var/log/radius/radacct/126.96.36.199/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.