Re: crontab(1) using stdin

Steffen Nurpmeso <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <20241031003531.kmaUa7JP@steffen%sdaoden.eu>
наб 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 <[email protected]\
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.