Basic Shell (Console) operation for beginners

Booting, installing, newbie
Message
Author
User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#316 Post by technosaurus »

Maybe not by the time they get to this page.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Mercedes350se
Posts: 790
Joined: Wed 16 Apr 2008, 11:28

save-dvb question

#317 Post by Mercedes350se »

I found this script at:

http://turtlespond.net/scripts/scripts/save-dvb

but it states, in part, "Scheduling is via atd ... ".

Searching I found this site:

http://www.simplehelp.net/2009/05/04/ho ... t-command/

Unfortunately my full 3.01 HDD install does not seem to have this command.

What can I do?

Edit: I found this tutorial quite interesting because it does, in part, what I hope to achieve eventually.

http://turtlespond.net/bash_scripting_t ... index.html

It may be of some use to some one else.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#318 Post by technosaurus »

at/atd is similar to cron/crond

see also:
http://www.wensley.org.uk/dvb
http://ffmpeg.org/ffmpeg.html#Video-and-Audio-grabbing
(I don't know a light command line way to change channels though... )
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#319 Post by Semme »

*Pass..
Last edited by Semme on Sun 05 Feb 2012, 05:50, edited 1 time in total.

Mercedes350se
Posts: 790
Joined: Wed 16 Apr 2008, 11:28

#320 Post by Mercedes350se »

technosaurus wrote:at/atd is similar to cron/crond ...
Thank you. I understand that in this script the command is used for one time "scheduling" of the recording function.

So what I need to be able to do is:

1. monitor the time presumably of the RTC - I do not want to download any programs to connect to a time server i.e. up to me to ensure that the RTC is reasonably correct.

2. when the scheduled start time is reached recording will start, and

3. when the duration/stop time is reached stop recording.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#321 Post by technosaurus »

I kinda have a daemon process script in my head but I am not at a linux box to test, maybe someone who is can fix my best guess

Code: Select all

while : do
sleep 1 &
sPID=$!
read TIME < /proc/$sPID/stime
case "$TIME" in
$MYSTARTTIME)record >file.mp2 &
  rPID=$!
  sleep 30
  ;;
$MYENDTIME)kill $rPID
  ;;
esac
sleep 30
done
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Mercedes350se
Posts: 790
Joined: Wed 16 Apr 2008, 11:28

#322 Post by Mercedes350se »

Let me state that I am a bash neophyte so I have been "playing" with the above script but I keep getting the error message:

syntax error near unexpected token `done'

Would somebody analyse the script and advise. Please.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#323 Post by technosaurus »

sorry about that, my memory failed me

first I forgot to put the : in parens (:)

I was in C mode and thinking of stat/lstat and that they would correspond to the /proc/PID ... but they are in /proc/PID/stat in a difficult to interpret way (seconds since epoch)

the equivalent is
stat -c %y /proc/pid

but if you are going to do that, you may as well just use date

-sorry, couldn't do a shell only version (well not quickly or easy to follow)

see date --help for the formats

ex.
date +%D@%R
will give you
month/day/year@military time

which will let you do
STARTTIME="05/05/12@22:30"


CURRENTTIME=`date +%D@%R`

if [ "$STARTTIME" == "$CURRENTTIME" ]; then
#your record code here &
rPID=$!
fi

if [ "$STOPTIME" == "$CURRENTTIME" ]; then
kill $rPID
fi
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Mercedes350se
Posts: 790
Joined: Wed 16 Apr 2008, 11:28

#324 Post by Mercedes350se »

It appears that there is no provision for CURRENTTIME to be "polled" until such time that it equals STARTTIME or am I missing something?

Shep
Posts: 878
Joined: Sat 08 Nov 2008, 07:55
Location: Australia

#325 Post by Shep »

Mercedes350se wrote:Let me state that I am a bash neophyte so I have been "playing" with the above script but I keep getting the error message:

syntax error near unexpected token `done'

Would somebody analyse the script and advise. Please.
I fixed the while loop. But can't comment on the rest. :)

Code: Select all

while true
do
sleep 1 &
sPID=$!
read TIME < /proc/$sPID/stime
case "$TIME" in
$MYSTARTTIME)record >file.mp2 &
  rPID=$!
  sleep 30
  ;;
$MYENDTIME)kill $rPID
  ;;
esac
sleep 30
done

Shep
Posts: 878
Joined: Sat 08 Nov 2008, 07:55
Location: Australia

Re: save-dvb question

#326 Post by Shep »

Mercedes350se wrote:I found this script at:

http://turtlespond.net/scripts/scripts/save-dvb

but it states, in part, "Scheduling is via atd ... ".

Searching I found this site:

http://www.simplehelp.net/2009/05/04/ho ... t-command/

Unfortunately my full 3.01 HDD install does not seem to have this command.

What can I do?
Puppy has the pschedule command.

Also see How to set a cron job.

Mercedes350se
Posts: 790
Joined: Wed 16 Apr 2008, 11:28

#327 Post by Mercedes350se »

Shep,

Thank you for your input.

Regarding pschedule command and cron - it looks as though these are to schedule tasks on a regular basis rather than, in my case, simply recording "as needed".

Shep
Posts: 878
Joined: Sat 08 Nov 2008, 07:55
Location: Australia

#328 Post by Shep »

Mercedes350se wrote:Regarding pschedule command and cron - it looks as though these are to schedule tasks on a regular basis rather than, in my case, simply recording "as needed".
To install the "at" scheduler follow the links. http://www.murga-linux.com/puppy/viewtopic.php?t=76335

Mercedes350se
Posts: 790
Joined: Wed 16 Apr 2008, 11:28

#329 Post by Mercedes350se »

Shep,

Thanks. One more question - where do I extract it to?

Shep
Posts: 878
Joined: Sat 08 Nov 2008, 07:55
Location: Australia

#330 Post by Shep »

Mercedes350se wrote:where do I extract it to?
It's a single binary file, so wherever you like. 8)

If you type echo $PATH you'll see the directories that are set to be searched for a command, so any of those will do.

IMO /usr/local/bin sounds appropriate

Mercedes350se
Posts: 790
Joined: Wed 16 Apr 2008, 11:28

#331 Post by Mercedes350se »

Thank you.

bakekoq
Posts: 18
Joined: Tue 12 Jun 2012, 12:45

#332 Post by bakekoq »

Hello, I want to ask about how do we can copy paste the texts from console? I thought that we can right click after blocking the text to the notepad. but, It doesn't work. anybody can help me?

and also, how do I install my wireless? because, my laptop still don't detect any wireless extension when I type: iwconfig.


Thanks before.

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#333 Post by Lobster »

highlight text and click the mouse wheel
middle button or both buttons simultaneously
where you want text to appear.

May take a few attempts to get the hang of it . . .
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
russoodle
Posts: 707
Joined: Fri 12 Sep 2008, 17:36
Location: Down-Under in South Oz

#334 Post by russoodle »

@ bakekoq.....hello....
Hello, I want to ask about how do we can copy paste the texts from console? I thought that we can right click after blocking the text to the notepad. but, It doesn't work. anybody can help me?
To paste into a text editor, after you block-select (highlight) your text, go to your text editor and press your middle mouse-button or wheel at the location where you want it.

For your wireless issues, may i suggest you post a new thread for that, because this thread is about console operations.

Cheers,
russoodle :)

oops, Lobster beat me to it :(
[i][color=Green][size=92]The mud-elephant, wading thru the sea, leaves no tracks..[/size][/color][/i]

bakekoq
Posts: 18
Joined: Tue 12 Jun 2012, 12:45

#335 Post by bakekoq »

Lobster wrote:highlight text and click the mouse wheel
middle button or both buttons simultaneously
where you want text to appear.

May take a few attempts to get the hang of it . . .
it's still not working, Lobster.
I try to click the mouse wheel simultaneously and also try to click right n left button but it's still not appear. I look up into the "edit" menu but the "paste" is still not activated/highlighted.
any info again?

@russoodle: hello.
hmm.. I try to abiword for now, and the Paste is Highlighted for now.but, after I try to click it. nothing is viewed. I don't know the reason why is it hard for me for only copying the console texts to Wine Notepad or Abiword. T_T
Last edited by bakekoq on Thu 12 Jul 2012, 13:47, edited 1 time in total.

Post Reply