tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: crontab(1) using stdin



наб wrote in
 <ljhzqcqk5my5o7xjgnepl7fwhg6zu5qji4piseacuwzxwhfujj@tarta.nabijaczleweli\
 .xyz>:
 |On Thu, Oct 31, 2024 at 12:35:01AM +0100, Steffen Nurpmeso wrote:
 |> наб wrote in
 |>  <q2pxxf2jv42trd53f3vu6n6656i2oxsne4p4pefirzq52mru7j@tarta.nabijaczleweli\
 |>  \
 |>  .xyz>:
 |>|You can still write this portably:
 |>|  echo crontab > ./-
 |>|  crontab - < -
 |>|  rm -
 |>|unideal, sure, but.
 |> OpenIndiana says
 |>   #?1|oi-2024:steffen$ crontab -
 |>   crontab: can't open your crontab file.
 |Regardless of the school this subscribes to it should work.
 |
 |I tried to install openindiana to test but the images don't work,
 |but if it's similar to the illumos gate crontab then I don't see why it
 |wouldn't
 |} else {
 |                if (argc == 0)
 |                        copycron(stdin);
 |                else if (seteuid(getuid()) != 0 || (fp = fopen(argv[0], \
 |                "r"))
 |                    == NULL)
 |                        crabort(BADOPEN);
 |                else {
 |                        seteuid(0);
 |                        copycron(fp);
 |}
 |}
 |(BADOPEN is "can't open your crontab file.")
 |
 |Beside something funny like, say, special - handling?
 |But unclear why the fopen would fail then or what it'd be.
 |What about... "crontab -- - < -"?

Ok i simply did not get it.
It is a smart solution indeed!

 --End of <ljhzqcqk5my5o7xjgnepl7fwhg6zu5qji4piseacuwzxwhfujj@tarta.nabij\
 aczleweli.xyz>

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
|
|And in Fall, feel "The Dropbear Bard"s ball(s).
|
|The banded bear
|without a care,
|Banged on himself fore'er and e'er
|
|Farewell, dear collar bear


Home | Main Index | Thread Index | Old Index