04-25-04 06:34 PM
>>>>> "Tom" == Tom <tcarmich@nortelnetworks.com> writes:
Tom> I am looking for an automated way to edit a crontab, as root I can use
sed
Tom> and modify the file. As a non root user I am not allowed to edit the f
ile.
Tom> IS there a way to create a shell script that my userid can execute, tha
t
Tom> will have root privileges to modify the command. I want to send this t
o all
Tom> the workstations when installing some software?
If this is vixie cron, just set an env var to your script:
EDITOR=/your/script crontab -e
/your/script will get invoked with /tmp/some-name containing the crontab.
Just rewrite the file, and exit clean. If the crontab is syntax-valid,
then it gets installed as the new crontab.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment PERL training
!
[ Post a follow-up to this message ]
|