I have stunnel4 installed on Ubuntu 10.04. It works as intended except that it often does not start properly after the PC is rebooted. So I have the following commands which will bring up stunnel4
Quote:
sudo /etc/init.d/stunnel4 stop
sudo /etc/init.d/stunnel4 start
|
If I execute them in a terminal they work fine. So I added a check on the status of stunnel4
and built a little script
Quote:
#!/bin/bash
ps -ely | grep stunnel
read nothing
sudo /etc/init.d/stunnel4 stop
read nothing
ps -ely | grep stunnel
read nothing
sudo /etc/init.d/stunnel4 start
read nothing
ps -ely | grep stunnel
read nothing
|
which does the work and shows me what is going on step by step. Except...
The script does not work. It asks me for the sudo password and appears to execute each step as expected. However, when it is complete, stunnel4 is not working. The last two steps produce this result
Quote:
Starting SSL tunnels: [Started: /etc/stunnel/stunnel.conf] stunnel.
S 1000 16042 16041 0 80 0 1452 2683 wait pts/1 00:00:00 restart_stunnel
S 118 16065 1 0 80 0 732 8849 unix_s pts/1 00:00:00 stunnel4
S 118 16066 1 0 80 0 732 8849 unix_s pts/1 00:00:00 stunnel4
S 118 16067 1 0 80 0 732 8849 unix_s pts/1 00:00:00 stunnel4
S 118 16068 1 0 80 0 732 8849 unix_s pts/1 00:00:00 stunnel4
S 118 16069 1 0 80 0 732 8849 unix_s pts/1 00:00:00 stunnel4
S 118 16070 1 0 80 0 996 8880 poll_s ? 00:00:00 stunnel4
|
so it appears the stunnel4 is working. After the script exits and I check manually from a terminal I find
Quote:
ken@taylor12:~$ ps -ely | grep stunn
S 118 16070 1 0 80 0 996 8880 poll_s ? 00:00:00 stunnel4
|
and in fact stunnel4 is not working (as determined by running the application I have configured to make use of stunnel4). After manually running the stop and start commands I find this state
Quote:
ken@taylor12:~$ ps -ely | grep stunn
S 118 16103 1 0 80 0 728 8849 unix_s pts/0 00:00:00 stunnel4
S 118 16104 1 0 80 0 728 8849 unix_s pts/0 00:00:00 stunnel4
S 118 16105 1 0 80 0 728 8849 unix_s pts/0 00:00:00 stunnel4
S 118 16106 1 0 80 0 728 8849 unix_s pts/0 00:00:00 stunnel4
S 118 16107 1 0 80 0 728 8849 unix_s pts/0 00:00:00 stunnel4
S 118 16108 1 0 80 0 992 8880 poll_s ? 00:00:00 stunnel4
|
Here is the rest of the story...
I run the scrip by clicking it from within Nautilus and telling it to "Run in Terminal". I just tried running the script from an already opened bash terminal thusly
and it worked fine. stunnel4 is operational.
This leads me to suspect that something strange is going on when Nautilus opens a terminal to execute the script. I do not find anything in the Nautilus preferences dealing with the terminal. Can anyone provide any insight on what is going on here?
TIA,
Ken
p.s. I am not really concerned with fixing stunnel4 not starting on reboot. I do not reboot often, generally only when Ubuntu pushes out kernel patches (which is perhaps too often but that is another issue).