LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   System maintenance 2 questions (https://www.linuxquestions.org/questions/linux-newbie-8/system-maintenance-2-questions-920540/)

iceqube 12-26-2011 04:45 AM

System maintenance 2 questions
 
Since a few weeks I am playing with debian and now I have 2 questions.

The first one:

I want to create weekly a file to all user directories.
I know that you have a cronjob to schedule it weekly. In this cronjob I have written the following line:

df >> /home/%users/diskspace.txt

I've tried this first in the shell, but it won't put the outcome to all other home directories. How can I realize that this file is created in each home directory?


Second question is, how can I give all users of member group such as "family" a nice welcomes message?


Thanks.
Icy

ochienged 12-26-2011 01:11 PM

Hello, I'll begin with your second question. To have a message to all system users by editing /etc/motd. If you are specific that the message must only be sent to members of the family group,you may be have to write your own script that would run when each user logs in and would check if they are a member of the group family before executing to completion.

Ill, give you some heads up on getting the groups to which a user belongs
Quote:

groups $USER | awk -F: '{ print $2 }'
On to your first question, the script should be run from an account with privileges to access(read and write) all other users home directories. Like, root. And this script should be started from root's home directory. A script created in a particular users domain can only run in that users domain.


All times are GMT -5. The time now is 04:05 PM.