Hello I''ve got OpenSolaris 2009.06 I''ve created crontab entry using crontab -e command and crontab -l gives me the output 0 12 * * 0 pfexec zpool scrub rpool On sunday at 12:10 AM zpool status told me that scrub was not done. svcs | grep cron online Oct_27 svc:/system/cron:default Why zpool scrub was not done? Thanks Vano Beridze -- This message posted from opensolaris.org
Vano Beridze wrote:> Hello > > I''ve got OpenSolaris 2009.06 > > I''ve created crontab entry using crontab -e command > and crontab -l gives me the output > 0 12 * * 0 pfexec zpool scrub rpool > > On sunday at 12:10 AM zpool status told me that scrub was not done. > > svcs | grep cron > online Oct_27 svc:/system/cron:default > > Why zpool scrub was not done?What did the output of the cron job say? My guess would be that zpool wasn''t in the PATH. -- Andrew
where can I see the output of the cron job? -- This message posted from opensolaris.org
Vano Beridze wrote:> where can I see the output of the cron job? >man cron... cron captures the output of the job''s stdout and stderr streams, and, if it is not empty, mails the output to the user. If the job does not produce output, no mail is sent to the user. -- Andrew
Now I''ve logged in and there was a mail saying that cron did not found zpool it''s in my path which zpool /usr/sbin/spool Does cron use different PATH setting? Is it ok to specify /usr/sbin/zpool in crontab file? -- This message posted from opensolaris.org
On Sun, Nov 1, 2009 at 3:45 PM, Vano Beridze <vanuatoo at gmail.com> wrote:> Now I''ve logged in and there was a mail saying that cron did not found zpool > > it''s in my path > which zpool > /usr/sbin/spool > > Does cron use different PATH setting?Yes. Typically your PATH is set up by various shell initialisations which may not get run for Cron jobs. In any case, it''s safer to assume it''s not.> Is it ok to specify /usr/sbin/zpool in crontab file?It is in fact preferable to specify fully qualified paths in crontabs generally, so yes. Alex
It''s ok to use zpool full path. Nontheless, I''d suggest you read crontab man page to learn how you can set some options, such as paths, shell, timezones and so on directly into your crontab files. On Nov 1, 2009, at 16:45, Vano Beridze <vanuatoo at gmail.com> wrote:> Now I''ve logged in and there was a mail saying that cron did not > found zpool > > it''s in my path > which zpool > /usr/sbin/spool > > Does cron use different PATH setting? > > Is it ok to specify /usr/sbin/zpool in crontab file? > -- > This message posted from opensolaris.org > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
I''ve looked at man cron and found out that I can modify /etc/default/cron file to set PATH that is defaulted for /usr/bin for mortal users and /usr/bin:/usr/sbin for root. I did not change /etc/default/cron file, instead I''ve indicated full path in my crontab file. Ethically speaking I guess scrubbing filesystem weekly is an administrative task and it''s more applicable to root user, So If I had created crontab job for root user the whole PATH problem would not arise. Anyways it''s my desktop so I''m the man and woman in here and there is no big difference what user''s crontab will do the job. :) -- This message posted from opensolaris.org
Glad it helped you. As far as it concerns your observation about the root user, please take into account that Solaris Role Based Access control lets you fine tune privileges you grant to users: your "ZFS administrator" needs not be root. Specifically, if you have a look at your /etc/prof_attr and /etc/exec_attr, you''ll notice that there exist two profiles: ZFS Storage Management and ZFS File System Management: exec_attr:ZFS File System Management:solaris:cmd:::/sbin/zfs:euid=0 exec_attr:ZFS Storage Management:solaris:cmd:::/sbin/zpool:uid=0 You can run the zfs and zpool command from a "mortal user" account with pfexec if such users is associated with the corresponding profile. Bye, Enrico On Sun, Nov 1, 2009 at 9:03 PM, Vano Beridze <vanuatoo at gmail.com> wrote:> I''ve looked at man cron and found out that I can modify /etc/default/cron file to set PATH that is defaulted for /usr/bin for mortal users and /usr/bin:/usr/sbin for root. > > I did not change /etc/default/cron file, instead I''ve indicated full path in my crontab file. > > Ethically speaking I guess scrubbing filesystem weekly is an administrative task and it''s more applicable to root user, So If I had created crontab job for root user the whole PATH problem would not arise. > > Anyways it''s my desktop so I''m the man and woman in here and there is no big difference what user''s crontab will do the job. :) > -- > This message posted from opensolaris.org > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss >-- ????????? ? ??????? "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." GPG key: 1024D/FD2229AF
What "root user" would that be then? "root" is just a role by default in OpenSolaris. Now sit down the next bit will come as a shock. Go to Systems -> Administration -> User and Groups Select a user and click the properties button that un-greys You can give the user profiles and roles!! I know scary stuff. Scared me when I found it the other day :-) Although the help is not very helpful and seems to be written by somebody in something close to, but not quite English. It also seems to have been written by somebody who is looking at a different interface than me, because I can''t see how you are suppose to add or modify a profile, and roles are not even mentioned. 3.7. To create new profile For opening the profiles window, you must press the Edit user profiles that is inside the new users window, then press the Add button, a new window will appear asking you for the new profile data. For creating a new profile, you must at least provide the profile name, the default home directory, the default shell and the default maximum/minimum user/group ID. If you want to replace any part of the default home directory with the user name, you can use the $user keyword (i.e.: /home/$user). BTW: After much hunting. Add User -> Advanced Tab -> Edit Users Profiles -> Add Profile And when you get through the maze to add a new profile it talks about "privileges" which seems to be the same list as "profiles" how anybody who does not understand RBAC is suppose to use this is beyond me. Oh well can''t have everything. Rome was not built in a day. Enrico Maria Crisostomo wrote: Glad it helped you. As far as it concerns your observation about the root user, please take into account that Solaris Role Based Access control lets you fine tune privileges you grant to users: your "ZFS administrator" needs not be root. Specifically, if you have a look at your /etc/prof_attr and /etc/exec_attr, you''ll notice that there exist two profiles: ZFS Storage Management and ZFS File System Management: exec_attr:ZFS File System Management:solaris:cmd:::/sbin/zfs:euid=0 exec_attr:ZFS Storage Management:solaris:cmd:::/sbin/zpool:uid=0 You can run the zfs and zpool command from a "mortal user" account with pfexec if such users is associated with the corresponding profile. Bye, Enrico On Sun, Nov 1, 2009 at 9:03 PM, Vano Beridze wrote: I''ve looked at man cron and found out that I can modify /etc/default/cron file to set PATH that is defaulted for /usr/bin for mortal users and /usr/bin:/usr/sbin for root. I did not change /etc/default/cron file, instead I''ve indicated full path in my crontab file. Ethically speaking I guess scrubbing filesystem weekly is an administrative task and it''s more applicable to root user, So If I had created crontab job for root user the whole PATH problem would not arise. Anyways it''s my desktop so I''m the man and woman in here and there is no big difference what user''s crontab will do the job. :) -- This message posted from opensolaris.org _______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss www.eagle.co.nz This email is confidential and may be legally privileged. If received in error please destroy and immediately notify us. _______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
On a related note, it looks like Constantin is developing a nice SMF service for auto scrub: http://blogs.sun.com/constantin/entry/new_opensolaris_zfs_auto_scrub This is an adaptation of the well-tested auto snapshot service. Amongst other advantages, this approach means that you don''t have to deal directly with cron. I''ll be interested to see the enhancement for persistent logging of scrub events, which will simplify things a bit. -cheers, CSB -- This message posted from opensolaris.org