Ubuntu 16.04 LTS user
Hi guys, I am a newb here and I have been searching these forums and google to no avail. My searches have not found the specific info that I need.
This is personal project of mine to help me get accustomed to setting system jobs and scripts that will run daily/monthly/any time refrence.
I have already (inefficiently) created several folders for the 10-12 users on my Ubuntu machine already where I want this job to go. It is in their home directory in a folder titled 'ulogs'. That is the folder I will be hopefully have the various system wide jobs I create, save files for every user on the system.
I know this job is to be created in cron.daily as a script. I know how frequently I want to run it, perhaps twice a day at some point but will start with once a day right now.
In the script, what is the protocol to save the contents/end result of the job to the folder I've created and selected where I want to save a txt file of job?
For this job, I want to save the contents of the auth.log (the cron script is basically "cat /var/log/auth.log > /home/Users(1-12)/ulogs/daily-signin.txt")
What variables can I use instead of typing out every users username and folder path where the file should be saved.
I'll also want to append the date to the end of the file but I'll figure that out on my own, I can't have you guys doing all the work. I've been searching but I've bounced around from site to site and have not found an efficient way to save the file to every users folder path.
Please help!