Feature #13066
closedWant crontab -u
100%
Description
It would be useful if the crontab
command supported a -u username
option to specify the username for the operation.
Without this, there is currently no easy way for root to replace a user's crontab, resulting in various tricks being employed such as:
# Unfortunately, illumos cron does not allow for root to # easily replace a user's crontab, so we copy the file directly # into place and then edit the user's cron file with the # 'touch' editor a second later to cause cron to re-read. cp $file /var/spool/cron/crontabs/$user sleep 1 env -i EDITOR=touch crontab -e $user
The -u option is also something that is common on other operating systems so adding it as a general flag will help with software portability and allow for removing workaround in various build systems (pkgsrc etc.) in the longer term.
Proposed new synopsis. Note that the three shipped copies of crontab
will be updated with this change:
- /usr/bin/crontab
- /usr/xpg4/bin/crontab
- /usr/xpg6/bin/crontab
SYNOPSIS /usr/bin/crontab [-u username] [filename] /usr/bin/crontab { -e | -l | -r } [username] /usr/bin/crontab -u username { -e | -l | -r } /usr/xpg4/bin/crontab [filename] /usr/xpg4/bin/crontab { -e | -l | -r } [username] /usr/xpg4/bin/crontab -u username { -e | -l | -r } /usr/xpg6/bin/crontab [filename] /usr/xpg6/bin/crontab { -e | -l | -r } [username] /usr/xpg6/bin/crontab -u username { -e | -l | -r }
Updated by Andy Fiddaman almost 2 years ago
Webrev also at http://cr.illumos.org/~webrev/citrus/ig_13066_crontab-u/
for an easier way to view the man page changes.
Updated by Andy Fiddaman almost 2 years ago
I tested this by building an updated crontab
binary and then trying combinations of options to show that previous options continue to be accepted and perform the same function as previously, and that the new options work as expected in all combinations.
Updated by Electric Monk almost 2 years ago
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
git commit 6863ede29751efd2be66ec1b48c3c0ee705d7d61
commit 6863ede29751efd2be66ec1b48c3c0ee705d7d61 Author: Andy Fiddaman <omnios@citrus-it.co.uk> Date: 2020-08-25T15:11:53.000Z 13066 Want crontab -u Reviewed by: Peter Tribble <peter.tribble@gmail.com> Reviewed by: Dominik Hassler <hadfl@omniosce.org> Approved by: Robert Mustacchi <rm@fingolfin.org>