我需要能够使用bash创建一个脚本,该脚本将报告特定组的成员(用户在此组中),将输出写入文件并使用crontab来安排脚本
我已经完成了Crontab部分,但不确定这是否也是正确的:
- 5:55am: 55 5 * * 1-5 /bin/sh /home/test/membersofgroup.sh
- 9:55am: 55 9 * * 1-5 /bin/sh /home/test/membersofgroup.sh
- 3:55pm: 55 15 * * 1-5 /bin/sh /home/test/membersofgroup.sh
问候。
答案 0 :(得分:0)
将@ Barmar的crontab
条目与awk
合并:
$ cat >> crontab_file_of_yours.txt
55 5,9,15 * * 1-5 awk -F\: '/^specific:/ && $0=$4' /etc/group >> /pathto/file.txt
$ crontab crontab_file_of_yours.txt