|
Home > Archive > Unix Shell > December 2007 > How to put an entry in crontab using only one command ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to put an entry in crontab using only one command ?
|
|
| apogeusistemas@gmail.com 2007-12-04, 1:38 am |
| 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
| |
| Glenn Jackman 2007-12-04, 1:38 am |
| 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
| |
| Michael Tosch 2007-12-04, 7:25 pm |
| Glenn Jackman wrote:
> At 2007-12-03 09:55PM, "apogeusistemas@gmail.com" wrote:
>
> 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
|
|
|
|
|