Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2002
    Karachi, Pakistan

    How to run commands in Startup using KDE at RH8

    Dear Fellows,

    I have installed Red Hat Linux 8 with KDE. This station needs to access data from a NT4 Server using SAMBA. I have done all the SAMBA config work. I am using SMBMOUNT command for SAMBA on terminal. Now I want to autorun this command at startup.

    Is there any thing like AUTOEXEC.BAT file in DOS/WINDOWS

    Please help.....

    Khalid Umer

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Täby, Sweden
    There are several counterparts of autoexec.bat:
    The first thing run by the kernel on boot is /sbin/init, which is the program that initializes everything else. It, in turn, looks at its configuration file /etc/inittab to decide what to do next. In the standard RH8 config, it executes /etc/rc.d/rc.sysinit, which initializes the system, ie. mounts local filesystem (networking is not yet turned on at this stage), loads sound modules, and so on. When rc.sysinit has finished, it enters one of seven runlevels (0 through 6). Usually this is 3 (for text mode) or 5 (for graphical mode). It looks in the directory named /etc/rc.d/rc<r>.d, where <r> is the runlevel to enter. It then first runs all the executables in there named K* with the argument "stop", and then all named S* with the argument "start", for is for Killing and Starting different subsystems, such as networking, sendmail, etc. These files are normally symlinks to the scripts in /etc/rc.d/init.d. You can also (as root, naturally) run these scripts manually to start and stop different subsystems, with the convenience script "service", as in "service sendmail stop" to shut down sendmail. Check out /etc/rc.d/init.d to see what scripts there are.
    At the end of each runlevel, /etc/rc.d/rc.local is normally run, so that's one place to add things on your own if you don't want to write a service script for /etc/rc.d/init.d. However, since you want to mount a file system, I suggest that you take a look at /etc/fstab. Local filesystems in there are mounted by rc.sysinit, and network file systems are mounted by the service netfs when networking is up. What you want to add is a line looking something like this:
    //server/share   /mnt/smb  smbfs   defaults 0 0
    I think you can guess what //server/share should be, and /mnt/smb could of course be replaced for anywhere that you'd like to mount this share. For more information on the file format of fstab, see the manpage fstab(5). Briefly, though: the first column is what you want to mount, eg. the share name when using smbfs, the second column is where you want to mount it, the third is the file system to use, in this case smbfs, the fourth is the mount flags with some more options that can only be used in fstab, such as the option "defaults" (see mount( for more details). The fifth is the dump frequency (just set this to zero and don't care about it; you're very unlikely to need it), and the sixth is the fsck order, zero if it shouldn't be fsck'd, which smbfs cannot be.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts