LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   SUSE / openSUSE (https://www.linuxquestions.org/questions/suse-opensuse-60/)
-   -   Boot.local wont launch sh (https://www.linuxquestions.org/questions/suse-opensuse-60/boot-local-wont-launch-sh-722793/)

FLCL 04-30-2009 03:41 PM

Boot.local wont launch sh
 
opensuse 11.1

So i've edited my boot.local file to launch an sh script on startup so it temporarily mounts my other drives for the session. Though when i logged off and logged back in to test it, nothing worked. I had to do it all manually.

Have I done something wrong, or missing something? Also does anyone know if it is possible to run kicker through cli? without having to F2 and type kicker for it to launch, I want the kicker to launch on start up as well but not sure how to do this. Please help.
Code:

#! /bin/sh
#
# Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany.  All rights reserved.
#
# Author: Werner Fink <werner@suse.de>, 1996
#        Burchard Steinbild, 1996
#
# /etc/init.d/boot.local
#
# script with local commands to be executed from init on system startup
#
# Here you should add things, that should happen directly after booting
# before we're going to the first run level.
#
sh /home/mine/Documents/Storage.sh


BruceCadieux 05-01-2009 06:21 PM

I recently ran into a similar problem.

Moving my script to the /opt directory and making sure it was executable solved my problem.

FLCL 05-05-2009 09:44 PM

Well i would try it, but now the script isnt even working for some reason. When i try to execute it from terminal i get the following

Code:

$LogFile indicates unclean shutdown (0, 0)
Failed to mount '/dev/sdc1': Operation not supported
Mount is denied because NTFS is marked to be in use. Choose one action:

Choice 1: If you have Windows then disconnect the external devices by
          clicking on the 'Safely Remove Hardware' icon in the Windows
          taskbar then shutdown Windows cleanly.

Choice 2: If you don't have Windows then you can use the 'force' option for
          your own responsibility. For example type on the command line:

            mount -t ntfs-3g /dev/sdc1 /media/Storage -o force

    Or add the option to the relevant row in the /etc/fstab file:

            /dev/sdc1 /media/Storage ntfs-3g force 0 0

I have never seen that since I made the script, but now all of the sudden I boot up to linux and launch it and behold. Can anyone tell me why all of the sudden Im geting this and how I would fix it?

rnturn 05-20-2009 11:42 PM

Quote:

Originally Posted by BruceCadieux (Post 3527286)
I recently ran into a similar problem.

Moving my script to the /opt directory and making sure it was executable solved my problem.

A couple of observations:

First, since you were explicitly passing the name of the script to "sh" it really didn't need to be made executable itself.

Second, the comment at the bottom of the boot.local file indicates that that script is run before the system has even entered run level "1". I believe the only filesystem you can count on being available at that time is the root filesystem. If /opt was not a separate filesystem but rather part of the root filesystem, it would explain why your script worked when you put it in /opt instead of /home. (I'd bet that the boot process displayed a "file not found" error when the script was sitting under /home.)

Another option would have been to leave the low-level boot script alone (it'll almost certainly get overwritten when you upgrade) and write a script, say "do_local_stuff", that you keep in /etc/init.d/ (or even better, if /usr/local is a separate filesystem, in /usr/local/etc/init.d/ to keep it safe during upgrades or reinstalls) and link to it in the rc3.d directory: "ln -s /etc/init.d/do_local_stuff S99do_local_stuff". The "S99" prefix should cause it to run last (or darned near) in the initialization process. That way you can rely on everything in the system being available for your script to use.

Finally, wouldn't the mounting that you're doing be done more easily by just adding the appropriate lines to /etc/fstab? Doing the mounts as part of some other script that's going to get run anyway during the boot process is going to always mount the drives just like they would via /etc/fstab. Just a thought...

Anyway, hope some of this helps.


--
Rick


All times are GMT -5. The time now is 01:16 PM.