I'd like to be able to do the following as user cg:-
mv /var/mail/cg ~/backup/mail
Now I know I can't actually do this because /var/mail is owned by mail and cg doesn't have write permission there. Is there any way that I can set things up so that 'cg' can do it or is there an alternative that produces the same result?
I could do something like:-
cp /var/mail/cg ~/backup/mail cp emptyFile /var/mail/cg
This would have the same effect *except* that it's not atomic so if mail arrives between the cp commands it would get lost.
What I'm trying to do is have a crude backup of my incoming mail, I forward all my incoming mail to 'cg' as well as to myself and want to run a cron job to do the above 'move' once a week so that all my mail for the last seven days is in /var/mail/cg and mail for the previous seven days is in /home/cg/backup/mail.
I could run the cron job as root I suppose, that would do what I want, but I'm just looking for neater/safer ways of doing it.