When I run
$ reboot on my embedded FreeNAS 0.7 (FreeBSD 7.2) it does start the shut down procedure but seemingly hangs.
I have registered a command to start a service script which is executed on PostInit:
It has works flawlessly so far.
Now I registered a second service
and had to realize that the PostInit script seems to be blocked by the first service (because it runs infinitely) and seemingly does not allow the PostInit to resume to it's next task. Consequently service 2 is never started.
To allow the script to continue I appended the
& to the commands to be executed.
This works as intended, both services are started up and run as expected.
But when I
$ reboot the system will not shutdown within seconds like before (it eventually seems to complete the reboot after hours [I let it sit over night]).
When the reboot is initialized the ssh session (I am dropped) and all services are gone within seconds - however I can still ping the machine.
ssh does not work (connection refused).
Cleanly exiting (or even killing) the services before
$ reboot has no effect.
The whole issue also is reproducible with only one service as long as I appended the
& at it's call.
Apparently a simple self ending process like
ps -Auw > /myLogs/postInit.log & will cause the issue too.
I am stumped and could really need a hint.
I don't know how to say this but... it's fixed. And I have no idea how. All I did was let some time pass (writing this question) then tried with
$ shutdown -r now which worked. Then tried
$ reboot which now worked too. Since then everything now runs as intended but I do not know what I did to fix it! There was nothing after writing this, that I haven't done before - except for running
shutdown -r that one time after which everything magically worked.
I have tried to forcefully reproduce the problem but haven't been able to do so, before I could easily test by adding or removing that little
&. I still have to explicitly run the scripts as background processes, else the PostInit script is blocked.