Nginx – tmpwatch not deleting folders and mp3 files in /tmp

nginxtmptmpwatch

I have a process which moves files from our EC2 server to s3, we're not sure why but it stores them in /tmp whilst moving them, but for some reason it also leaves them there once the process has completed.

This would be fine if tmpwatch deleted them, but it doesn't. They go into a folder called mixtape2 so the location is /tmp/mixtape2 here is my tmpwatch now, could someone help as to what I need to add change to make this happen to files a day old? (or if its possible to delete them from /tmp as soon as they are moved)

#! /bin/sh
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
-X '/tmp/hsperfdata_*' -a -f 1d /tmp
/usr/sbin/tmpwatch "$flags" 1d /var/tmp
/usr/sbin/tmpwatch "$flags" -a -f 1d /tmp/mixtape2
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch "$flags" -f 1d "$d"
fi
done

Best Answer

If you have files owned by root user and root group and the user trying to delete them is not in that group or the root user then your permissions have to be set to allow deletes.

So you seem to have one folder that is

drwxr-xr-x this means anyone can enter the folder but only root can delete or add things to the folder its self.

drwxrwxrwt this means anyone can delete or add something to the folder

If you have files in a folder then tmpwatch wont delete the folder So make sure the permissions of the files in that folder can be modifyed by that user.