Find the answer to your Linux question:
Results 1 to 10 of 10
hey everyone, I am needing to run a few commands each time I boot up and was wondering what is the correct way to go about this. I have heard ...
  1. #1
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    101

    running commands on boot/login

    hey everyone,

    I am needing to run a few commands each time I boot up and was wondering what is the correct way to go about this. I have heard a range of things that usually include rc.d. I need to run commands to 1.) mount my hard secondary hard drive 2.) set my screen blank time and 3.) set my background with fbsetbg.

    any direction/suggestions would be great!

    thanks,
    Erik

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    1.) mount my hard secondary hard drive
    execute this code in terminal/konsole and post output here.
    Code:
    su -
    fdisk -l
    2)set my screen blank time
    3)set my background with fbsetbg.
    can you explain a little bit more?






    Casper
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    101
    devils_casper:

    Code:
    fdisk -l
    gives me no output.

    the commands i do upon login are:

    Mounting drive:
    Code:
    mount -t ext3 /dev/hdd1 /maxtor
    Change to no screen blanking time:
    Code:
    xset s blank
    xset s 0
    Change to: no standby, no suspend time, and 30000 sec monitor off time:
    Code:
    xset dpms 0 0 30000

  4. #4
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    you must be root to execute fdisk command.
    mount -t ext3 /dev/hdd1 /maxtor
    add this line in /etc/fstab file
    Code:
    /dev/hdd1    /maxtor    ext3    defaults,umask=0 0 0





    Casper
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  5. #5
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    101
    thanks Casper.

    I'm still getting nothing for the fdisk command even when root... any ideas?

  6. #6
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    thats weird ! did you add code in /etc/fstab file? it should mount hdb1 at boot up.
    try '/sbin/fdisk -l'.
    i asked for output of fsidk coz i didn't know the partition structure of second harddisk. you are mounting only one partition of second disk. it means, second disk has only one partition and i posted code for that.





    Casper
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  7. #7
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    101
    this is quite strange....

    Code:
    debian:~# fdisk
    
    Usage: fdisk [-l] [-b SSZ] [-u] device
    E.g.: fdisk /dev/hda  (for the first IDE disk)
      or: fdisk /dev/sdc  (for the third SCSI disk)
      or: fdisk /dev/eda  (for the first PS/2 ESDI drive)
      or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices)
      ...
    it seems to be going into fdisk alright but it wont do fdisk -l

    I however can do fdisk -l /dev/hdd which gives me:

    Code:
    debian:~# fdisk -l /dev/hdd
    
    Disk /dev/hdd: 300.0 GB, 300090728448 bytes
    255 heads, 63 sectors/track, 36483 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/hdd1               1       36483   293049666    1  FAT12
    yet I don't know why it would be FAT12? I formatted to ext3 and when i mount it is ext3

    also my hard drive didn't mount when i booted up... I do only have one partition on the drive

    strange stuff... if you have any other thoughts they would be greatly appreciated!

  8. #8
    Linux Engineer Zelmo's Avatar
    Join Date
    Jan 2006
    Location
    Riverton, UT, USA
    Posts
    1,001
    For your xset commands, you can make an init script. Or if you're using KDE, making an Autostart script is slightly easier. The script will be the same either way:
    Code:
    #!/bin/sh
    xset s blank
    xset s 0
    xset dpms 0 0 30000
    Just copy and paste that into a blank text file, save the file and make it executable (chmod +x filename). For KDE, put the file into your ~/.kde/Autostart directory. Every time KDE starts, those commands will be run.

    A more universal way to do it (at least for Debian and Debian-based distros) is to put the script into /etc/init.d and make a symlink in the rc directory for whatever runlevel you want to run the commands. IIRC, Debian defaults to runlevel 2, so do something like this as root:
    Code:
    ln -s /etc/init.d/filename /etc/rc2.d/S99filename
    If you want to be sure it runs regardless of what runlevel you boot into, do the above command for rc2.d through rc5.d.
    Stand up and be counted as a Linux user!

  9. #9
    Linux User
    Join Date
    Feb 2006
    Posts
    484
    maybe delete the partition and create a new one if it possible
    use cfdisk command
    and than run "mkfs.ext3"

  10. #10
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    101
    I've got a ton of stuff on therer it's really not worth making the transfer. I'm gonna mess around with those rc.d files when I've got some time. Thanks for all the input guys

Posting Permissions

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