[opensuse] init.d script automatic start, not (just) run
After much hunting, I've failed to get an answer to my question. How do I START an inet.d script? I've written a script to run at level 5 (network +X) and have the R and S scripts in rc5.d. It's basically a script that initiates an ssh session with another machine. After boot, its status is "running," yet it's not connected. I can manually start it, but I want it to not only run but start automatically upon boot. Thanks for your consideration. -- www.nealhogan.net www.lambdaserver.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, 2009-04-06 at 17:25 -0500, Neal Hogan wrote:
After much hunting, I've failed to get an answer to my question.
How do I START an inet.d script?
I've written a script to run at level 5 (network +X) and have the R and S scripts in rc5.d.
If you copied or linked the script in rc5.d, that will not work in a SUSE system, and is documented. You need to use insserv, chkconfig, or yast to insert the links. If you do it manually, it will fail. And in order for the script to be inserted, you need the script have the headers. See /etc/init.d/skeleton.compat for a sample and read the documentation. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAknah6wACgkQtTMYHG2NR9VxdwCgkbzNdRrrTRw2TSZFDwlDVSI7 uZ8AnjvqXfK58o7rsl5EmaHEffSiYUll =/1le -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Mon, Apr 6, 2009 at 5:52 PM, Carlos E. R.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Monday, 2009-04-06 at 17:25 -0500, Neal Hogan wrote:
After much hunting, I've failed to get an answer to my question.
How do I START an inet.d script?
I've written a script to run at level 5 (network +X) and have the R and S scripts in rc5.d.
If you copied or linked the script in rc5.d, that will not work in a SUSE system, and is documented. You need to use insserv, chkconfig, or yast to insert the links. If you do it manually, it will fail.
And in order for the script to be inserted, you need the script have the headers. See /etc/init.d/skeleton.compat for a sample and read the documentation.
Thanks for the responses. I have read the documentation and sample init.d scripts and have chconfig'd my script . . . I did all of this before posting the first time (sorry for not being clearer). The script definitely runs at runlevel 5 (it's status after boot is "running"), but the script isn't started automatically. I guess I'm missing something about init.d scripts. I thought that it would START the script at the particular runlevel. Note that I'm running OpenSUSE-11.1 w/gnome What I want is a script to start at boot time or as soon as it's finished booting and running X, etc. I'm in the (un)fortunate position of maintaining my parents machine and I want to have access to it whenever. It's behind a firewall, so I need to make an ssh tunnel that I can use to get at their machine (eg., ssh -R 4444:localhost:22 user@server). I've done this before on another system, where I just put the ssh script in their .xinitrc. But, the OpenSUSE system doesn't seem to require the .xinitrc, so I'm trying to accomplish this task without using it. Any suggestions would help and be appreciated.
- -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux)
iEYEARECAAYFAknah6wACgkQtTMYHG2NR9VxdwCgkbzNdRrrTRw2TSZFDwlDVSI7 uZ8AnjvqXfK58o7rsl5EmaHEffSiYUll =/1le -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-- www.nealhogan.net www.lambdaserver.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Neal Hogan wrote:
What I want is a script to start at boot time or as soon as it's finished booting and running X, etc. I'm in the (un)fortunate position of maintaining my parents machine and I want to have access to it whenever. It's behind a firewall, so I need to make an ssh tunnel that I can use to get at their machine (eg., ssh -R 4444:localhost:22 user@server). I've done this before on another system, where I just put the ssh script in their .xinitrc. But, the OpenSUSE system doesn't seem to require the .xinitrc, so I'm trying to accomplish this task without using it.
Without having thought a lot about it, I would do something like this: create a script /etc/init.d/sshtunnel - use /etc/init.d/skeleton as a template. Amend the script to do the startproc ssh -R 4444:localhost:22 user@server. Then use insserv to get the script inserted into the init-sequence. I would probably use runlevel 3. I've done this numerous times, always works. /Per -- Per Jessen, Zürich (12.1°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday, 2009-04-07 at 15:47 -0500, Neal Hogan wrote:
I have read the documentation and sample init.d scripts and have chconfig'd my script . . . I did all of this before posting the first time (sorry for not being clearer). The script definitely runs at runlevel 5 (it's status after boot is "running"), but the script isn't started automatically. I guess I'm missing something about init.d scripts. I thought that it would START the script at the particular runlevel.
I don't understand this paragraph. You say that “The script definitely runs at runlevel 5” and later you say that “the script isn't started automatically”. Both affirmations are mutually excluyent, that can not be. Please clarify. I suggest you look inside the boot log for messages from that init script, and possible to boot in verbose mode (no splash screen). - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkndMcQACgkQtTMYHG2NR9Xk6wCeMyksjt6X6ntpU6ChU34Z5f2D diQAn3tA5qPVRVrFDwX0woDf0DG2K+kR =dYut -----END PGP SIGNATURE-----
On Wed, Apr 8, 2009 at 6:22 PM, Carlos E. R.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Tuesday, 2009-04-07 at 15:47 -0500, Neal Hogan wrote:
I have read the documentation and sample init.d scripts and have chconfig'd my script . . . I did all of this before posting the first time (sorry for not being clearer). The script definitely runs at runlevel 5 (it's status after boot is "running"), but the script isn't started automatically. I guess I'm missing something about init.d scripts. I thought that it would START the script at the particular runlevel.
I don't understand this paragraph. You say that “The script definitely runs at runlevel 5” and later you say that “the script isn't started automatically”. Both affirmations are mutually excluyent, that can not be. Please clarify.
I found this to be odd as well . . . that's why I'm posting. The reason why I say it's running at level 5 is because I set the default start run level to 5 and when I chkconfig'd it it said "rc5.d: on" and then when I check it's status after boot (#/etc/init.d/script status), it says that it's running, but I have no ssh connection. However, I can manually start the script (#/etc/init.d/script start)and, therefore, the ssh connection. So, I say that it's running, yet not started.
I suggest you look inside the boot log for messages from that init script, and possible to boot in verbose mode (no splash screen).
I'll check this . . . thanks!
- -- Cheers, Carlos E. R.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux)
iEYEARECAAYFAkndMcQACgkQtTMYHG2NR9Xk6wCeMyksjt6X6ntpU6ChU34Z5f2D diQAn3tA5qPVRVrFDwX0woDf0DG2K+kR =dYut -----END PGP SIGNATURE-----
-- www.nealhogan.net www.lambdaserver.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Content-ID:
chconfig'd my script . . . I did all of this before posting the first time (sorry for not being clearer). The script definitely runs at runlevel 5 (it's status after boot is "running"), but the script isn't started automatically. I guess I'm missing something about init.d scripts. I thought that it would START the script at the particular runlevel.
I don't understand this paragraph. You say that “The script definitely runs at runlevel 5” and later you say that “the script isn't started automatically”. Both affirmations are mutually excluyent, that can not be. Please clarify.
I found this to be odd as well . . . that's why I'm posting. The reason why I say it's running at level 5 is because I set the default start run level to 5 and when I chkconfig'd it it said "rc5.d: on" and then when I check it's status after boot (#/etc/init.d/script status), it says that it's running, but I have no ssh connection. However, I can manually start the script (#/etc/init.d/script start)and, therefore, the ssh connection. So, I say that it's running, yet not started.
You then should say that the init script run, but it is not working >:-) The reason for the failure should be logged in the boot.msg log file. As Verner Kjærsgaard said, I'd check that network and dns is really up at the moment this scripts runs. Anything the script may need should be running already. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAknd7o8ACgkQtTMYHG2NR9Xo/ACfWUeMiw4h4k349PeQc86OR/aY YygAn1pZfGrh3njlVUvHPHN/dfkPLHWX =ckRb -----END PGP SIGNATURE-----
On Thu, Apr 9, 2009 at 7:48 AM, Carlos E. R.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Content-ID:
On Wednesday, 2009-04-08 at 19:21 -0500, Neal Hogan wrote:
chconfig'd my script . . . I did all of this before posting the first time (sorry for not being clearer). The script definitely runs at runlevel 5 (it's status after boot is "running"), but the script isn't started automatically. I guess I'm missing something about init.d scripts. I thought that it would START the script at the particular runlevel.
I don't understand this paragraph. You say that “The script definitely runs at runlevel 5” and later you say that “the script isn't started automatically”. Both affirmations are mutually excluyent, that can not be. Please clarify.
I found this to be odd as well . . . that's why I'm posting. The reason why I say it's running at level 5 is because I set the default start run level to 5 and when I chkconfig'd it it said "rc5.d: on" and then when I check it's status after boot (#/etc/init.d/script status), it says that it's running, but I have no ssh connection. However, I can manually start the script (#/etc/init.d/script start)and, therefore, the ssh connection. So, I say that it's running, yet not started.
You then should say that the init script run, but it is not working >:-)
The reason for the failure should be logged in the boot.msg log file. As Verner Kjærsgaard said, I'd check that network and dns is really up at the moment this scripts runs. Anything the script may need should be running already.
Sorry about the terminology . . . As you guys suspected, the network is not completely up when the script is called. I've tried the script both at runlevel 3 and 5 and various Required-Start options, including $network, $named, and $time. My workaround (at this point) is to have a gnome session that starts the script. This requires that I open a terminal and execute the ssh connection there. Thanks for your time.
- -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux)
iEYEARECAAYFAknd7o8ACgkQtTMYHG2NR9Xo/ACfWUeMiw4h4k349PeQc86OR/aY YygAn1pZfGrh3njlVUvHPHN/dfkPLHWX =ckRb -----END PGP SIGNATURE-----
-- www.nealhogan.net www.lambdaserver.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 09 April 2009 14:12:05 Neal Hogan wrote:
As you guys suspected, the network is not completely up when the script is called. I've tried the script both at runlevel 3 and 5 and various Required-Start options, including $network, $named, and $time.
My workaround (at this point) is to have a gnome session that starts the script. This requires that I open a terminal and execute the ssh connection there.
Thanks for your time.
Run it as the last startup script, maybe add a delay. Mike. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (4)
-
Carlos E. R.
-
ka1ifq
-
Neal Hogan
-
Per Jessen