In ksh93u+ I'm using the built-in 'alarm' timer command.
$ alarm --man
Usage: alarm [-r] [varname seconds]
(The original 'alarm' feature may have been experimental
and not documented well, but it was nonetheless useful.)
Just noticed in ksh93u+m that the 'alarm' timer command
doesn't seem to be available; I now get errors like
"alarm: not found"
and
timer.alarm: invalid discipline function
Is there some substitute in ksh93u+m that will replace
that function from the original ksh? (Or something else
to do to get it working?) Or has that feature just been
abandoned in the "u+m" branch?
On Sun, 17 Mar 2024 10:48:21 -0400, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
In ksh93u+ I'm using the built-in 'alarm' timer command.
$ alarm --man
Usage: alarm [-r] [varname seconds]
(The original 'alarm' feature may have been experimental
and not documented well, but it was nonetheless useful.)
Just noticed in ksh93u+m that the 'alarm' timer command
doesn't seem to be available; I now get errors like
"alarm: not found"
and
timer.alarm: invalid discipline function
Is there some substitute in ksh93u+m that will replace
that function from the original ksh? (Or something else
to do to get it working?) Or has that feature just been
abandoned in the "u+m" branch?
I'm not a ksh user, so don't know much about it. I recommend using the package
"at" for setting alarms and it's not shell dependent.
On 17.03.2024 18:49, David W. Hodgins wrote:
On Sun, 17 Mar 2024 10:48:21 -0400, Janis Papanagnou
<janis_papanagnou+ng@hotmail.com> wrote:
In ksh93u+ I'm using the built-in 'alarm' timer command.
$ alarm --man
Usage: alarm [-r] [varname seconds]
(The original 'alarm' feature may have been experimental
and not documented well, but it was nonetheless useful.)
Just noticed in ksh93u+m that the 'alarm' timer command
doesn't seem to be available; I now get errors like
"alarm: not found"
and
timer.alarm: invalid discipline function
Is there some substitute in ksh93u+m that will replace
that function from the original ksh? (Or something else
to do to get it working?) Or has that feature just been
abandoned in the "u+m" branch?
I'm not a ksh user, so don't know much about it. I recommend using the
package
"at" for setting alarms and it's not shell dependent.
Thanks for the suggestion. It reminds me that I obviously
should have made the use case clear, where and how I want
to use the timer. For example; I want to display a turning
"wheel" (or maybe a growing bar) while some operation is
in progress. I might use such a timer in a program called
'busy'. And instead of calling
$ long_running_process arguments
I'd call it as
$ busy long_running_process arguments
The program 'busy' could be something like
$ cat ~/bin/busy
typeset busy='/-\|'
typeset -i i=0
alarm -r timer +0.25
function timer.alarm { print -u2 -f "%c\b" -- "${busy:i++%4:1}" ;}
( "$@" & wait )
unset timer
with 'alarm' and 'timer.alarm' used as supported by ksh93u+.
I suppose the 'at' command is not suited for such purposes.
The program 'busy' could be something like
$ cat ~/bin/busy
typeset busy='/-\|'
typeset -i i=0
alarm -r timer +0.25
function timer.alarm { print -u2 -f "%c\b" -- "${busy:i++%4:1}" ;}
( "$@" & wait )
unset timer
with 'alarm' and 'timer.alarm' used as supported by ksh93u+.
I suppose the 'at' command is not suited for such purposes.
On 2024-03-17, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
The program 'busy' could be something like
$ cat ~/bin/busy
typeset busy='/-\|'
typeset -i i=0
alarm -r timer +0.25
function timer.alarm { print -u2 -f "%c\b" -- "${busy:i++%4:1}" ;}
( "$@" & wait )
unset timer
with 'alarm' and 'timer.alarm' used as supported by ksh93u+.
I suppose the 'at' command is not suited for such purposes.
Remember how I rigged something up in the Basta project to spontaneously update the clock in the status line, while the shell is waiting for
input or running scripts?
Forked process periodically killing parent with signal, which has a trap handler for it.
On 2024-03-17, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
The program 'busy' could be something like
$ cat ~/bin/busy
typeset busy='/-\|'
typeset -i i=0
alarm -r timer +0.25
function timer.alarm { print -u2 -f "%c\b" -- "${busy:i++%4:1}" ;}
( "$@" & wait )
unset timer
with 'alarm' and 'timer.alarm' used as supported by ksh93u+.
I suppose the 'at' command is not suited for such purposes.
Remember how I rigged something up in the Basta project to spontaneously update the clock in the status line, while the shell is waiting for
input or running scripts?
Forked process periodically killing parent with signal, which has a trap handler for it.
On Sun, 17 Mar 2024 14:15:11 -0400, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
On 17.03.2024 18:49, David W. Hodgins wrote:
On Sun, 17 Mar 2024 10:48:21 -0400, Janis Papanagnou
<janis_papanagnou+ng@hotmail.com> wrote:
In ksh93u+ I'm using the built-in 'alarm' timer command.
$ alarm --man
Usage: alarm [-r] [varname seconds]
(The original 'alarm' feature may have been experimental
and not documented well, but it was nonetheless useful.)
Just noticed in ksh93u+m that the 'alarm' timer command
doesn't seem to be available; I now get errors like
"alarm: not found"
and
timer.alarm: invalid discipline function
Is there some substitute in ksh93u+m that will replace
that function from the original ksh? (Or something else
to do to get it working?) Or has that feature just been
abandoned in the "u+m" branch?
I'm not a ksh user, so don't know much about it. I recommend using the
package
"at" for setting alarms and it's not shell dependent.
Thanks for the suggestion. It reminds me that I obviously
should have made the use case clear, where and how I want
to use the timer. For example; I want to display a turning
"wheel" (or maybe a growing bar) while some operation is
in progress. I might use such a timer in a program called
'busy'. And instead of calling
$ long_running_process arguments
I'd call it as
$ busy long_running_process arguments
The program 'busy' could be something like
$ cat ~/bin/busy
typeset busy='/-\|'
typeset -i i=0
alarm -r timer +0.25
function timer.alarm { print -u2 -f "%c\b" -- "${busy:i++%4:1}" ;}
( "$@" & wait )
unset timer
with 'alarm' and 'timer.alarm' used as supported by ksh93u+.
I suppose the 'at' command is not suited for such purposes.
For that use case, I'd use a loop in a separate script with "sleep
0.5s". Have the main script start it in the background, and kill it
when the process is done. The script containing the loop could create
a pid file so the main script knows what process to kill, or have the
main script create a temp file, pass the name to the loop script, and
have the loop script exit after the main script deletes the temp
file.
On 17.03.2024 21:01, Kaz Kylheku wrote:
On 2024-03-17, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
The program 'busy' could be something like
$ cat ~/bin/busy
typeset busy='/-\|'
typeset -i i=0
alarm -r timer +0.25
function timer.alarm { print -u2 -f "%c\b" -- "${busy:i++%4:1}" ;}
( "$@" & wait )
unset timer
with 'alarm' and 'timer.alarm' used as supported by ksh93u+.
I suppose the 'at' command is not suited for such purposes.
Remember how I rigged something up in the Basta project to spontaneously
update the clock in the status line, while the shell is waiting for
input or running scripts?
Forked process periodically killing parent with signal, which has a trap
handler for it.
Yes, I remember. There's a couple options to solve such a task. In case
I have a simple built-in method available I'd prefer that, though.
Janis
I think several OSes have a tool called 'progress' which sort of
functions as you've described; NetBSD does natively.
Having it built-in would be better though. Was 'alarm' removed in
ksh93?
On 18.03.2024 15:14, Arti F. Idiot wrote:
I think several OSes have a tool called 'progress' which sort of
functions as you've described; NetBSD does natively.
Oh, I wasn't aware that there's some OS specific standard for that.
Having it built-in would be better though. Was 'alarm' removed in
ksh93?
It was (still is) there in [official] ksh93u+. That was the version
I predominantly used on my platforms.
Meanwhile I've replaced the "u+" version by Martijn Dekker's "u+m"
version. (The latter has less bugs and works much more reliable.)
It's just my recent switch that made me notice that in his branch
there's no 'alarm' available any more.
Janis
I think several OSes have a tool called 'progress' which sort of
functions as you've described; NetBSD does natively.
Scheduled commands run only while the shell is waiting at a prompt for
input.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 422 |
Nodes: | 16 (2 / 14) |
Uptime: | 196:41:36 |
Calls: | 8,951 |
Calls today: | 2 |
Files: | 13,352 |
Messages: | 5,992,477 |