A few days ago I posted an article about the inability to run Foxpro as
a daemon process. Since then I found out that Fox can be run under cron
so I tried this out. Aside from doing silly things like setting a TERM
type, just running Fox (no program, no database manipulations, no nothing)
causes the following behaviour:
OS: SCO Unix 3.2v4.2 in single user mode
Script started on Fri Jun 30 15:46:40 1995
# ps -aef
UID PID PPID C STIME TTY TIME COMMAND
root 0 0 0 15:17:47 ? 0:00 sched
root 1 0 0 15:17:47 ? 0:00 /etc/init
root 2 0 0 15:17:47 ? 0:00 vhand
root 3 0 0 15:17:47 ? 0:00 bdflush
root 31 1 0 15:17:53 console 0:00 -
root 95 31 0 15:46:40 console 0:00 script
root 96 95 2 15:46:40 console 0:00 script
root 97 96 2 15:46:40 p0 0:00 sh -i
root 98 97 2 15:46:43 p0 0:00 ps -aef
root 66 1 0 15:44:24 ? 0:00 cron
# vmstat 5 5
PROCS PAGING SYSTEM CPU
r b w frs dmd sw cch fil pft frp pos pif pis rso rsi sy cs us su id
0 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 100
0 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 6 2 0 0 100
0 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 100
0 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 100
0 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 100
# at now + 1 minutes < foxstart
job 804545280.a at Fri Jun 30 15:48:00 CDT 1995
# at -l
user = root 804545280.a Fri Jun 30 15:48:00 CDT 1995
# cat foxstart
#!/bin/sh
TERM=ansi; export TERM
exec fox -t >/dev/null 2>&1
# ps -aef
UID PID PPID C STIME TTY TIME COMMAND
root 0 0 0 15:17:47 ? 0:00 sched
root 1 0 0 15:17:47 ? 0:00 /etc/init
root 2 0 0 15:17:47 ? 0:00 vhand
root 3 0 0 15:17:47 ? 0:00 bdflush
root 31 1 0 15:17:53 console 0:00 -
root 95 31 0 15:46:40 console 0:00 script
root 96 95 1 15:46:40 console 0:00 script
root 97 96 2 15:46:40 p0 0:00 sh -i
root 106 66 65 15:48:00 ? 0:06 /usr/lib/foxpro/foxpro.pr -t
root 66 1 0 15:44:24 ? 0:00 cron
root 108 97 3 15:48:06 p0 0:00 ps -aef
# vmstat 5 5
PROCS PAGING SYSTEM CPU
r b w frs dmd sw cch fil pft frp pos pif pis rso rsi sy cs us su id
1 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 3111 4 89 10 1
1 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 3092 6 88 12 0
1 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 3098 4 88 12 0
1 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 3097 4 87 12 1
1 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 3097 4 88 12 0
# kill -9 106
# vmstat 5 5
PROCS PAGING SYSTEM CPU
r b w frs dmd sw cch fil pft frp pos pif pis rso rsi sy cs us su id
0 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 100
0 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 6 2 0 0 100
0 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 100
0 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 100
0 10 0 30000 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 100
# exit
script done on Fri Jun 30 15:49:27 1995
As you can see, once Fox is running, it completely drains my processor with
needless CPU cycles looking for keyboard input (?). Now this behaviour does
NOT occur when just starting Fox after logging in. Whoever is responsible
for this program is clueless about what a bg job is. There is NO keyboard
input, you should not even look for any! My guess is that it is getting
bombarded with "fake" input. Try doing this for example:
$ fox -t < /dev/null
and see what kind of goofy behaviour you get. If you look at the output
of vmstat it looks about the same.
Anyway, I still don't really understand why this works at all under cron
but does not work under /etc/inittab as a daemon process. However, I do
know that it is really dumb not to provide a version of software that can
be run in the background correctly under a UNIX OS.
And this is an SCO Supported Product????