Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Need help for a Linux script file to run on startup.

  1. #1
    p38arover's Avatar
    p38arover is offline Major part of the heart and soul of AULRO.com
    Administrator
    I'm here to help you!
    Gold Subscriber
    Join Date
    Jan 1970
    Location
    Western Sydney
    Posts
    30,704
    Total Downloaded
    1.63 MB

    Need help for a Linux script file to run on startup.

    I'm replacing an old Windows 2000 laptop with 196kB of memory with a laptop running Linux. (Win 2000 will run happily in 196kB of memory - the max this laptop can run.)

    It monitors electricity consumption using a CurrentCost EnviR and uploads the data to PVOutput.org

    At the moment, using Terminal, I run these commands:

    minicom -D /dev/ttyUSB0 -b 57600 (sets USB port 0 to 57600 bps for the EnviR serial data)
    cd /pvoutput-install/bin
    chmod 755 pvoutput.sh (sets pvoutput.sh permissions to executable)
    ./pvoutput.sh (runs the script file)

    I tried adding them to the rc.local file but I'm not sure that's correct or even if it's working. If I subsequently try the minicom command, I get told the port is locked.

    This is what I have in the rc.local file:

    #!/bin/sh -e
    #
    # rc.local
    minicom -D /dev/ttyUSB0 -b 57600
    cd /pvoutput-install/bin
    chmod 755 pvoutput.sh
    ./pvoutput.sh
    exit 0


    If I can't work this out, I'll go back to Windows. The learning curve on Linux is quite steep. What's easy to do in Windows can be a pain in Linux. The reason I haven't gone back is that the laptop, currently loaded with Linux, is simply too slow** when Win XP SP3 is installed - also I'd like to minimise the vulnerability of my network by not running no longer supported versions of Windows.

    ** Too slow = up to 30 seconds to recognise a mouse click. And it crashes regularly. The laptop originally came with Win XP SP1 and cost me over $2K when I bought it new! It was quick back then. I hate throwing usable stuff out. This laptop will have no other duty other than to monitor power consumption.
    Ron B.
    VK2OTC

    2003 L322 Range Rover Vogue 4.4 V8 Auto
    2007 Yamaha XJR1300
    Previous: 1983, 1986 RRC; 1995, 1996 P38A; 1995 Disco1; 1984 V8 County 110; Series IIA



    RIP Bucko - Riding on Forever

  2. #2
    Join Date
    Sep 2014
    Location
    Australia
    Posts
    7
    Total Downloaded
    0
    Quote Originally Posted by p38arover View Post
    I'm replacing an old Windows 2000 laptop with 196kB of memory with a laptop running Linux. (Win 2000 will run happily in 196kB of memory - the max this laptop can run.)

    It monitors electricity consumption using a CurrentCost EnviR and uploads the data to PVOutput.org

    At the moment, using Terminal, I run these commands:

    minicom -D /dev/ttyUSB0 -b 57600 (sets USB port 0 to 57600 bps for the EnviR serial data)
    cd /pvoutput-install/bin
    chmod 755 pvoutput.sh (sets pvoutput.sh permissions to executable)
    ./pvoutput.sh (runs the script file)

    I tried adding them to the rc.local file but I'm not sure that's correct or even if it's working. If I subsequently try the minicom command, I get told the port is locked.

    This is what I have in the rc.local file:

    #!/bin/sh -e
    #
    # rc.local
    minicom -D /dev/ttyUSB0 -b 57600
    cd /pvoutput-install/bin
    chmod 755 pvoutput.sh
    ./pvoutput.sh
    exit 0


    If I can't work this out, I'll go back to Windows. The learning curve on Linux is quite steep. What's easy to do in Windows can be a pain in Linux. The reason I haven't gone back is that the laptop, currently loaded with Linux, is simply too slow** when Win XP SP3 is installed - also I'd like to minimise the vulnerability of my network by not running no longer supported versions of Windows.

    ** Too slow = up to 30 seconds to recognise a mouse click. And it crashes regularly. The laptop originally came with Win XP SP1 and cost me over $2K when I bought it new! It was quick back then. I hate throwing usable stuff out. This laptop will have no other duty other than to monitor power consumption.
    You need to add the script to Cron.

    Crontab -e

    Have a look at the man page for the syntax

  3. #3
    p38arover's Avatar
    p38arover is offline Major part of the heart and soul of AULRO.com
    Administrator
    I'm here to help you!
    Gold Subscriber
    Join Date
    Jan 1970
    Location
    Western Sydney
    Posts
    30,704
    Total Downloaded
    1.63 MB
    Thanks for the reply.

    I thought cron was a scheduler. I won't be rebooting the laptop every day - only if it crashes.
    Ron B.
    VK2OTC

    2003 L322 Range Rover Vogue 4.4 V8 Auto
    2007 Yamaha XJR1300
    Previous: 1983, 1986 RRC; 1995, 1996 P38A; 1995 Disco1; 1984 V8 County 110; Series IIA



    RIP Bucko - Riding on Forever

  4. #4
    Join Date
    Apr 2002
    Location
    Godwin Beach 4511
    Posts
    20,688
    Total Downloaded
    32.38 MB
    Inittab script would be better
    2007 Discovery 3 SE7 TDV6 2.7
    2012 SZ Territory TX 2.7 TDCi

    "Make the lie big, make it simple, keep saying it, and eventually they will believe it." -- a warning from Adolf Hitler
    "If you don't have a sense of humour, you probably don't have any sense at all!" -- a wise observation by someone else
    'If everyone colludes in believing that war is the norm, nobody will recognize the imperative of peace." -- Anne Deveson
    “What you leave behind is not what is engraved in stone monuments, but what is woven into the lives of others.” - Pericles
    "We can ignore reality, but we cannot ignore the consequences of ignoring reality.” – Ayn Rand
    "The happiness of your life depends upon the quality of your thoughts." Marcus Aurelius

  5. #5
    p38arover's Avatar
    p38arover is offline Major part of the heart and soul of AULRO.com
    Administrator
    I'm here to help you!
    Gold Subscriber
    Join Date
    Jan 1970
    Location
    Western Sydney
    Posts
    30,704
    Total Downloaded
    1.63 MB
    Quote Originally Posted by incisor View Post
    Inittab script would be better
    It looks like Ubuntu doesn't use inittab but "upstart" instead.

    I'm getting closer to going back to Windows.
    Ron B.
    VK2OTC

    2003 L322 Range Rover Vogue 4.4 V8 Auto
    2007 Yamaha XJR1300
    Previous: 1983, 1986 RRC; 1995, 1996 P38A; 1995 Disco1; 1984 V8 County 110; Series IIA



    RIP Bucko - Riding on Forever

  6. #6
    VladTepes's Avatar
    VladTepes is offline Major Part of the Heart and Soul of AULRO Subscriber
    Join Date
    Feb 2004
    Location
    Bracken Ridge, Qld
    Posts
    16,055
    Total Downloaded
    0
    Hey Ron I just read your OP and for clarity's sake it would be awesome if in future you could use English.
    It's not broken. It's "Carbon Neutral".


    gone


    1993 Defender 110 ute "Doris"
    1994 Range Rover Vogue LSE "The Luxo-Barge"
    1994 Defender 130 HCPU "Rolly"
    1996 Discovery 1

    current

    1995 Defender 130 HCPU and Suzuki GSX1400


  7. #7
    Join Date
    Apr 2002
    Location
    Godwin Beach 4511
    Posts
    20,688
    Total Downloaded
    32.38 MB
    Quote Originally Posted by p38arover View Post
    It looks like Ubuntu doesn't use inittab but "upstart" instead.

    I'm getting closer to going back to Windows.
    Whatever it’s name, it will be a text file config file or files you can add your script to and that will control when your script will be run during startup
    2007 Discovery 3 SE7 TDV6 2.7
    2012 SZ Territory TX 2.7 TDCi

    "Make the lie big, make it simple, keep saying it, and eventually they will believe it." -- a warning from Adolf Hitler
    "If you don't have a sense of humour, you probably don't have any sense at all!" -- a wise observation by someone else
    'If everyone colludes in believing that war is the norm, nobody will recognize the imperative of peace." -- Anne Deveson
    “What you leave behind is not what is engraved in stone monuments, but what is woven into the lives of others.” - Pericles
    "We can ignore reality, but we cannot ignore the consequences of ignoring reality.” – Ayn Rand
    "The happiness of your life depends upon the quality of your thoughts." Marcus Aurelius

  8. #8
    Join Date
    Sep 2014
    Location
    Australia
    Posts
    7
    Total Downloaded
    0
    Does the script have its own polling process, or does it need calling every x minutes?

  9. #9
    Join Date
    Apr 2002
    Location
    Godwin Beach 4511
    Posts
    20,688
    Total Downloaded
    32.38 MB
    read this Ron?

    Getting Started - upstart
    2007 Discovery 3 SE7 TDV6 2.7
    2012 SZ Territory TX 2.7 TDCi

    "Make the lie big, make it simple, keep saying it, and eventually they will believe it." -- a warning from Adolf Hitler
    "If you don't have a sense of humour, you probably don't have any sense at all!" -- a wise observation by someone else
    'If everyone colludes in believing that war is the norm, nobody will recognize the imperative of peace." -- Anne Deveson
    “What you leave behind is not what is engraved in stone monuments, but what is woven into the lives of others.” - Pericles
    "We can ignore reality, but we cannot ignore the consequences of ignoring reality.” – Ayn Rand
    "The happiness of your life depends upon the quality of your thoughts." Marcus Aurelius

  10. #10
    p38arover's Avatar
    p38arover is offline Major part of the heart and soul of AULRO.com
    Administrator
    I'm here to help you!
    Gold Subscriber
    Join Date
    Jan 1970
    Location
    Western Sydney
    Posts
    30,704
    Total Downloaded
    1.63 MB
    Quote Originally Posted by DrewXT View Post
    Does the script have its own polling process, or does it need calling every x minutes?
    The script polls the data every 5 minutes.

    Quote Originally Posted by incisor View Post
    OK, thanks Dave.

    One other problem is I need to set the serial port baud rate which I am doing with:

    minicom -D /dev/ttyUSB0 -b 57600

    But minicom doesn't exit after setting the baud rate. If I run that command in Terminal, minicom doesn't return to the prompt:

    ron@Presario-X1400-PH511PA-ABG:~$

    Hmm, I've just found an Application AutoStart menu. I'll look into that.
    Ron B.
    VK2OTC

    2003 L322 Range Rover Vogue 4.4 V8 Auto
    2007 Yamaha XJR1300
    Previous: 1983, 1986 RRC; 1995, 1996 P38A; 1995 Disco1; 1984 V8 County 110; Series IIA



    RIP Bucko - Riding on Forever

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search AULRO.com ONLY!
Search All the Web!