How to put an entry in crontab using only one command ?
am 04.12.2007 03:55:27 von apogeusistemas
Hi:
Please, Is there any way to put an entry in crontab using only one
line command ?
I need put this command in 30 solaris's crontabs machines:
00 23 * * * * * /var/adm/monitor/collector > /var/adm/monitor/
collector.log
Re: How to put an entry in crontab using only one command ?
am 04.12.2007 04:42:02 von Glenn Jackman
At 2007-12-03 09:55PM, "apogeusistemas@gmail.com" wrote:
> Hi:
>
> Please, Is there any way to put an entry in crontab using only one
> line command ?
>
> I need put this command in 30 solaris's crontabs machines:
>
> 00 23 * * * * * /var/adm/monitor/collector > /var/adm/monitor/
> collector.log
by "one line command", I assume you want to avoid the interactivity of
'crontab -e':
crontab -l > tmpfile && echo "new entry" >> tmpfile && crontab tmpfile
For performing this on multiple boxes, I'd use expect.
--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
Re: How to put an entry in crontab using only one command ?
am 04.12.2007 22:14:38 von Michael Tosch
Glenn Jackman wrote:
> At 2007-12-03 09:55PM, "apogeusistemas@gmail.com" wrote:
>> Hi:
>>
>> Please, Is there any way to put an entry in crontab using only one
>> line command ?
>>
>> I need put this command in 30 solaris's crontabs machines:
>>
>> 00 23 * * * * * /var/adm/monitor/collector > /var/adm/monitor/
>> collector.log
>
> by "one line command", I assume you want to avoid the interactivity of
> 'crontab -e':
> crontab -l > tmpfile && echo "new entry" >> tmpfile && crontab tmpfile
>
> For performing this on multiple boxes, I'd use expect.
>
>
Hmm, with a tmpfile this is 100% safe.
For Solaris (any SysV cron??) I found that crontab buffers already,
so
(
crontab -l
echo "new entry"
) | crontab
works as well.
BTW the OP's "new entry" seems to have too many fields, should be:
"00 23 * * * /var/adm/monitor/collector > /var/adm/monitor/collector.log"
--
Michael Tosch @ hp : com