Find the answer to your Linux question:
Results 1 to 3 of 3
I use a simple script to time an exercise routine: sleep 5m ; warm up 5 minutes beep sleep 5m ; exercise 5 minutes beep beep and so on. The ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2010
    Posts
    2

    simple script to run external program


    I use a simple script to time an exercise routine:

    sleep 5m ; warm up 5 minutes
    beep
    sleep 5m ; exercise 5 minutes
    beep
    beep

    and so on.

    The problem is is that I can't always hear the beep over my treadmill/airdyne, so I'd like to throw in something like 'eog green.jpg' or 'eog red.jpg' to display a full screen graphic to display for the time interval and then stop. The problem is that once the external program is started, the script stops until that program is closed. How do I run the external program, eog, in this case and have the script continue to do the timing?

  2. #2
    Just Joined!
    Join Date
    Mar 2007
    Location
    Bogotá, Colombia
    Posts
    46
    You could try launching them on background and capturing the process ID:

    Code:
    eog image.png &
    lastpid=$!
    sleep 300
    kill $lastpid
    eog anotherimage.png &
    lastpid=$!
    something like that

  3. #3
    Just Joined!
    Join Date
    Apr 2010
    Posts
    2
    Thank you. That's what I needed.

Posting Permissions

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