Results 1 to 9 of 9

Thread: Linux - Quick question

  1. #1
    Jay
    Jay is offline
    Gentlemen.. we're history Jay's Avatar
    Join Date
    Aug 2006
    Location
    Jita
    Posts
    8,365
    Thanks
    304
    Thanked
    568 times in 409 posts

    Linux - Quick question

    I need to create a startup script in linux (CentOS)

    I have created the script in init.d and made it exacutable with chmod but the issue is the actual script itself

    For the life of me I can not get the program to start with the OS

    if I go to the directory eg

    cd the/directory/of/the/program

    and then

    ./theprogram

    it starts fine but how do I script this at startup??

    thanks.
    □ΞVΞ□

  2. #2
    ɯʎɔɐɹsɐʌʍ mycarsavw's Avatar
    Join Date
    Feb 2007
    Posts
    4,945
    Thanks
    1,097
    Thanked
    653 times in 482 posts
    • mycarsavw's system
      • Motherboard:
      • P8H77-M Pro
      • CPU:
      • i5 3350P
      • Memory:
      • 16Gb
      • Storage:
      • Lots
      • Graphics card(s):
      • R9 285
      • PSU:
      • HX 620w
      • Case:
      • FD Define Mini
      • Operating System:
      • W10
      • Monitor(s):
      • BenQ G2420HDBL + GL2450HT
      • Internet:
      • Sky

    Re: Linux - Quick question

    In Ubuntu;

    sudo nano /etc/init.d/<your script>
    <enter script commands>
    sudo chmod +x /etc/init.d/<your script>
    sudo update-rc.d <your script> defaults
    |Kata: "Read title as 'fisting'. Not sure why I clicked. Relieved, really."|
    |TAKTAK: "It was so small that mine wouldn't fit into it"|

  3. #3
    Gentoo Ricer
    Join Date
    Jan 2005
    Location
    Galway
    Posts
    11,048
    Thanks
    1,016
    Thanked
    944 times in 704 posts
    • aidanjt's system
      • Motherboard:
      • Asus Strix Z370-G
      • CPU:
      • Intel i7-8700K
      • Memory:
      • 2x8GB Corsiar LPX 3000C15
      • Storage:
      • 500GB Samsung 960 EVO
      • Graphics card(s):
      • EVGA GTX 970 SC ACX 2.0
      • PSU:
      • EVGA G3 750W
      • Case:
      • Fractal Design Define C Mini
      • Operating System:
      • Windows 10 Pro
      • Monitor(s):
      • Asus MG279Q
      • Internet:
      • 240mbps Virgin Cable

    Re: Linux - Quick question

    Quote Originally Posted by Agent View Post
    ...every time Creative bring out a new card range their advertising makes it sound like they have discovered a way to insert a thousand Chuck Norris super dwarfs in your ears...

  4. #4
    Jay
    Jay is offline
    Gentlemen.. we're history Jay's Avatar
    Join Date
    Aug 2006
    Location
    Jita
    Posts
    8,365
    Thanks
    304
    Thanked
    568 times in 409 posts

    Re: Linux - Quick question

    am I wrong to think that a linux startup script can simply look like this..

    #!/bin/bash
    cd the/localtion/of/the/program; ./program
    □ΞVΞ□

  5. #5
    mush-mushroom b0redom's Avatar
    Join Date
    Oct 2005
    Location
    Middlesex
    Posts
    3,438
    Thanks
    174
    Thanked
    362 times in 279 posts
    • b0redom's system
      • Motherboard:
      • Some iMac thingy
      • CPU:
      • 3.4Ghz Quad Core i7
      • Memory:
      • 24GB
      • Storage:
      • 3TB Fusion Drive
      • Graphics card(s):
      • nViidia GTX 680MX
      • PSU:
      • Some iMac thingy
      • Case:
      • Late 2012 pointlessly thin iMac enclosure
      • Operating System:
      • OSX 10.8 / Win 7 Pro
      • Monitor(s):
      • Dell 2713H
      • Internet:
      • Be+

    Re: Linux - Quick question

    Why don't you just do:

    #!/bin/bash
    /the/localtion/of/the/program/program

  6. #6
    Overclocking Since 1988 nightkhaos's Avatar
    Join Date
    Apr 2009
    Location
    Sydney, AU
    Posts
    1,415
    Thanks
    93
    Thanked
    127 times in 106 posts

    Re: Linux - Quick question

    Quote Originally Posted by b0redom View Post
    Why don't you just do:

    #!/bin/bash
    /the/localtion/of/the/program/program
    By running like that the program in question would take control of the machine, instead of executing in the background, thus halting the start-up process and preventing the system from being utilised until said application is terminated using Ctrl+C or similar.
    Desktop (Cy): Intel Core i7 920 D0 @ 3.6GHz, Prolimatech Megahalems, Gigabyte X58-UD5, Patriot Viper DDR3 6GiB @ 1440MHz 7-7-7-20 2T, EVGA NVIDIA GTX 295 Co-Op, Asus Xonar D2X, Hauppauge WinTV Nova TD-500, 2x WD Caviar Black 1TB in RAID 0, 4x Samsung EcoDrive 1.5TB F2s in RAID 5, Corsair HX 750W PSU, Coolermaster RC-1100 Cosmos Sport (Custom), 4x Noctua P12s, 6x Noctua S12Bs, Sony Optiarc DVD+/-RW, Windows 7 Professional Edition, Dell 2408WFP, Mirai 22" HDTV

    MacBook Pro (Voyager): Intel Core 2 Duo @ 2.6GHz, 4GiB DDR2 RAM, 200GB 7200RPM HDD, NVIDIA 8600GTM 512MB, SuperDrive, Mac OS X Snow Leopard, 15.4" Matte Display

    HTPC (Delta-Flyer): Intel Core 2 Q8200 @ 2.33GHz, Zotec GeForce 9300-ITX, 2GiB of DDR2 Corsair XMS2 RAM, KWorld PE355-2T, Samsung EcoDrive F2 1.5TB, In-Win BP655, Noctua NF-R8, LiteOn BluRay ROM Drive, Windows 7 Home Premium, 42" Sony 1080p Television

    i7 (Bloomfield) Overclocking Guide

    Quote Originally Posted by Spock
    I am not our father.

  7. #7
    Gentoo Ricer
    Join Date
    Jan 2005
    Location
    Galway
    Posts
    11,048
    Thanks
    1,016
    Thanked
    944 times in 704 posts
    • aidanjt's system
      • Motherboard:
      • Asus Strix Z370-G
      • CPU:
      • Intel i7-8700K
      • Memory:
      • 2x8GB Corsiar LPX 3000C15
      • Storage:
      • 500GB Samsung 960 EVO
      • Graphics card(s):
      • EVGA GTX 970 SC ACX 2.0
      • PSU:
      • EVGA G3 750W
      • Case:
      • Fractal Design Define C Mini
      • Operating System:
      • Windows 10 Pro
      • Monitor(s):
      • Asus MG279Q
      • Internet:
      • 240mbps Virgin Cable

    Re: Linux - Quick question

    Quote Originally Posted by Jay View Post
    am I wrong to think that a linux startup script can simply look like this..

    #!/bin/bash
    cd the/localtion/of/the/program; ./program
    Code:
    #!/bin/bash
    
    exec /path/to/program/binary
    Look at some of the scripts in /etc/init.d/ for examples to work off.
    Quote Originally Posted by Agent View Post
    ...every time Creative bring out a new card range their advertising makes it sound like they have discovered a way to insert a thousand Chuck Norris super dwarfs in your ears...

  8. #8
    Jay
    Jay is offline
    Gentlemen.. we're history Jay's Avatar
    Join Date
    Aug 2006
    Location
    Jita
    Posts
    8,365
    Thanks
    304
    Thanked
    568 times in 409 posts

    Re: Linux - Quick question

    cd; cd program/location; ./program works fine from the command line but from a script it doesn't work.

    I'll have to start again and have a look through the scripts.
    □ΞVΞ□

  9. #9
    Comfortably Numb directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,027 times in 678 posts
    • directhex's system
      • Motherboard:
      • Asus ROG Strix B550-I Gaming
      • CPU:
      • Ryzen 5900x
      • Memory:
      • 64GB G.Skill Trident Z RGB
      • Storage:
      • 2TB Seagate Firecuda 520
      • Graphics card(s):
      • EVGA GeForce RTX 3080 XC3 Ultra
      • PSU:
      • EVGA SuperNOVA 850W G3
      • Case:
      • NZXT H210i
      • Operating System:
      • Ubuntu 20.04, Windows 10
      • Monitor(s):
      • LG 34GN850
      • Internet:
      • FIOS

    Re: Linux - Quick question

    Init scripts aren't just "run", they're run with parameters like "start". Take a look at /etc/init.d/skeleton for an "empty" script which you can modify

    Oh, and stuff in init.d isn't just run on startup either - scripts symlinked from rc.d are

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Just a quick question re DFI LP DK X48 T2R
    By spiderdany in forum SCAN.care@HEXUS
    Replies: 0
    Last Post: 19-08-2008, 06:37 PM
  2. Quick Question - Just placed an order...
    By fonz_valo in forum SCAN.care@HEXUS
    Replies: 3
    Last Post: 01-08-2008, 10:05 AM
  3. Quick SATA drive question...
    By Nick in forum PC Hardware and Components
    Replies: 5
    Last Post: 03-02-2005, 04:07 PM
  4. Quick Psu question
    By 5cupa in forum PC Hardware and Components
    Replies: 7
    Last Post: 14-02-2004, 08:13 PM
  5. Quick Question need a quick answer?
    By ©DinG© in forum PC Hardware and Components
    Replies: 8
    Last Post: 06-02-2004, 12:06 PM

Posting Permissions

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