An endless loop in FreeBSD
I have a script that segfaults constantly - a problem I can't solve as a segfault in python libxml bindings - didn't write them. So, on Linux I used to run inf.loop so that when the script dies, it restarts, for example:
#!/bin/bash
while [ 1 ]
do
nice -n 19 python server.py
sleep 1
done
Well, I can't find / bin / bash in FreeBSD, so it won't work.
Any ideas? Note that cron is not an option - downtime is a few seconds.
/ bin / sh almost certainly exists, but if you really need bash:
cd /usr/ports/*/bash
make install
which should install bash to / usr / local / bin / bash, I believe
There will be some kind of shell program on the system and that script looks like it would run in almost any shell.
Enter type bash
to see where bash is. If not, try sh. It should be there and it should work. Take the result type bash
or type sh
and use / bin / bash instead. Alternatively take a look at / etc / passwd, find your account and notice the shell. I believe this is the last field and it will say something like / bin / sh or / usr / bin / bash or whatever. Use this instead of / bin / bash.
Not sure which default shell FreeBSD uses, but it probably has several. The man page for whatever shell you are using should tell you this shell loop syntax. It's probably pretty similar.