http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6302763
Category
utility
Sub-Category
misc
Description
"svcadm enable sar" does not enable sar. The crontab for sar remains commented out. The problem is with both the /lib/svc/method/svc-sar script, and file permissions in /var/spool/cron/crontabs. The script. assumes that we begin without a sys crontab (which is not the case), and also that we can rm an existing sys crontab (which fails as it runs as the sys user).
The following is the execsnoop DTrace program running while we disable sar,
# execsnoop
UID PID PPID ARGS
0 820 680 svcadm disable sar
3 821 7 /sbin/sh -c exec /lib/svc/method/svc-sar stop
3 821 7 /sbin/sh /lib/svc/method/svc-sar stop
3 822 821 /usr/bin/who -r
3 823 821 rm /var/spool/cron/crontabs/sys
On the last line, we can see the "rm" command runs as UID 3. The permissions on the crontabs directory are,
# ls -ld /var/spool/cron/crontabs
drwxr-xr-x 2 root sys 512 Apr 11 15:23 /var/spool/cron/crontabs
which is why the sys user fails to rm it's crontab file.
Frequency
Always
Regression
Solaris 10
Steps to Reproduce
# svcadm enable sar
# crontab -l sys
Expected Result
#
# sys crontab
#
# The sys crontab should be used to do performance collection.
# Please note that if the system/sar service is disabled this file
# will be deleted. Please keep a backup copy if you change the
# defaults.
#
0 * * * 0-6 /usr/lib/sa/sa1
20,40 8-17 * * 1-5 /usr/lib/sa/sa1
5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
Actual Result
#ident "@(#)sys 1.5 92/07/14 SMI" /* SVr4.0 1.2 */
#
# The sys crontab should be used to do performance collection. See cron
# and performance manual pages for details on startup.
#
# 0 * * * 0-6 /usr/lib/sa/sa1
# 20,40 8-17 * * 1-5 /usr/lib/sa/sa1
# 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
Error Message(s)
none
Test Case
Workaround
# svcadm enable sar
# chmod 775 /var/spool/cron/crontabs
# svcadm disable sar
# svcadm enable sar
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/228190/viewspace-670817/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/228190/viewspace-670817/