Cron running as user writes log file as root
I've got a cron in (cron.d) which runs nightly. It spawns a dspace index process as the 'dspace' user. This dspace index process writes to a /log directory many log files. The /log directory is owned by the dspace user...
drwxrwxr-x. 2 dspace dspace 4096 Feb 23 04:04 log Now when this cron runs and the log files are written to the /log directory, they are written with root as the owner and group. I was thinking since dspace owns the /log directory and since the dspace process is spawned using the dspace user that the log files would be written being owned by dspace. So, when the cron runs I'm getting (Permission denied) errors. Can someone please tell me where I'm going wrong on this? Thanks |
I think I may see why. The dspace script (file in /etc/cron.d was owned by root. I never changed the ownwer:group to dspace. I just changed it and I'll see if that fixed it.
|
/etc/crontab is the system crontab for my systems, it has a field for user:
Code:
2 2 * * * root /sbin/fstrim / |
All times are GMT -5. The time now is 08:27 PM. |