Re: UBUNTU on HERCULES

2016-06-23 Thread Alan Altmark
On Thursday, 06/23/2016 at 10:09 GMT, Tom Huegel  
wrote:
> I'm telling Hercules it is s z13 (2964 N30) but I don't know that 
Hercules
> does anything with that other than reflect it in the STSI instruction...
> How does UBUNTU determine the hardware level?

Did my post from earlier today not get re-distributed?
--
To be clear, the checks are not based on a machine type or model, per se. 
Rather, the OS is checking for the availability of needed instructions, 
service processor functionality, and I/O subsystem capability 
(collectively called 'facilities').  So you could change the CPU ID to 
report a zEC12, for example, but unless the various facilities the OS 
wants are available, you will still get BADCCC.
 
I.e. a zEC12 GA2 machine will have more facilities available than a GA1 
machine, but the machine type and model remains unchanged.
 
To see how instruction behavior is assessed, look at the STORE FACILITIES 
LIST EXTENDED (STFLE) instruction.


The host cannot use CPU type-model information to determine functional 
capability.  That way there be flames and damnation for all Eternity.

Alan Altmark

Senior Managing z/VM and Linux Consultant
Lab Services System z Delivery Practice
IBM Systems & Technology Group
ibm.com/systems/services/labservices
office: 607.429.3323
mobile; 607.321.7556
alan_altm...@us.ibm.com
IBM Endicott

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: UBUNTU on HERCULES

2016-06-23 Thread Mark Post
>>> On 6/23/2016 at 08:29 PM, Dimitri John Ledkov  wrote: 
> There is no special ways to determine the hardware levels.

Not _quite_ true.  Look at arch/s390/kernel/head.S to see what IBM is doing.  
In my reply to Tom, I mis-spoke.  It's not a STSI instruction but an STFLE that 
gets executed, and then they check for the bits they need for the instructions 
the kernel executes.

Once the kernel is up, then what you said comes into play.  Any zEC12 or later 
instructions that get executed will run into an illegal opcode exception.


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: UBUNTU on HERCULES

2016-06-23 Thread Neale Ferguson
STFL  STFLE to get the facilities available on a processor. Where
facilities are things like Message Security Assist 3 which tells you the
crypto instructions are present and support certain capabilities. You use
STFL first to tell you if STFLE is supported (historical reasons). STFLE
then gets all the facilities for that processor.

On 6/23/16, 8:39 PM, "Linux on 390 Port on behalf of Mark Post"
 wrote:

 On 6/23/2016 at 06:01 PM, Tom Huegel  wrote:
>> I'm telling Hercules it is s z13 (2964 N30) but I don't know that
>>Hercules
>> does anything with that other than reflect it in the STSI instruction...
>> How does UBUNTU determine the hardware level?
>
>I vaguely remember going through this with some SLES12 SP1 testing I did.
> The kernel does an STSI and then looks for certain bits to be turned on
>that came with (in SUSE's case) the z196/z114.
>
>I just re-ran some Google searches and came up with this:
>1. You need Hercules 3.08.2 or higher.  I built 3.12 to use on my
>workstation.
>2. You need to specify "ARCHMODE  z/Arch" in your hercules.cnf file.

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: UBUNTU on HERCULES

2016-06-23 Thread Alan Altmark
On Thursday, 06/23/2016 at 09:14 GMT, Mark Post  wrote:
> I don't think it's a Hercules requirement, necessarily.  Ubuntu requires 
a zEC12 or later machine
> to run.  If you can get Hercules to report that, then you should be OK.

To be clear, the checks are not based on a machine type or model, per se. 
Rather, the OS is checking for the availability of needed instructions, 
service processor functionality, and I/O subsystem capability 
(collectively called 'facilities').  So you could change the CPU ID to 
report a zEC12, for example, but unless the various facilities the OS 
wants are available, you will still get BADCCC.

I.e. a zEC12 GA2 machine will have more facilities available than a GA1 
machine, but the machine type and model remains unchanged.

To see how instruction behavior is assessed, look at the STORE FACILITIES 
LIST EXTENDED (STFLE) instruction.

Alan Altmark

Senior Managing z/VM and Linux Consultant
Lab Services System z Delivery Practice
IBM Systems & Technology Group
ibm.com/systems/services/labservices
office: 607.429.3323
mobile; 607.321.7556
alan_altm...@us.ibm.com
IBM Endicott

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: UBUNTU on HERCULES

2016-06-23 Thread Mark Post
>>> On 6/23/2016 at 06:01 PM, Tom Huegel  wrote: 
> I'm telling Hercules it is s z13 (2964 N30) but I don't know that Hercules
> does anything with that other than reflect it in the STSI instruction...
> How does UBUNTU determine the hardware level?

I vaguely remember going through this with some SLES12 SP1 testing I did.  The 
kernel does an STSI and then looks for certain bits to be turned on that came 
with (in SUSE's case) the z196/z114.

I just re-ran some Google searches and came up with this:
1. You need Hercules 3.08.2 or higher.  I built 3.12 to use on my workstation.
2. You need to specify "ARCHMODE  z/Arch" in your hercules.cnf file.


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: UBUNTU on HERCULES

2016-06-23 Thread Dimitri John Ledkov
Hello,

On 23 June 2016 at 23:01, Tom Huegel  wrote:
> Thanks Mark,
> I'm telling Hercules it is s z13 (2964 N30) but I don't know that Hercules
> does anything with that other than reflect it in the STSI instruction...
> How does UBUNTU determine the hardware level?
>

There is no special ways to determine the hardware levels. There is no
checking of CPU ids etc. Simply the compiler default architecture is
set to zEC12 across the board, meaning that glibc, kernel, and most
binaries rely on zEC12 only instructions. I do not believe these are
at all available, in full, on non zEC12 hardware.

In other words it's not possible to "fake" CPU id in Hercules / zPDT /
z/VM / z/KVM, as things simply segfault / fail with illegal
instructions at runtime. If future revisions of those virtual machines
implement zEC12 instructions, on pre-zEC12 hardware, one would be able
run Ubuntu 16.04 there.

Regards,

Dimitri.


> Tom
>
> On Thu, Jun 23, 2016 at 2:14 PM, Mark Post  wrote:
>
>> >>> On 6/23/2016 at 04:42 PM, Tom Huegel  wrote:
>> > I am having a problem trying to install UBUNTU s390x on Hercules.
>> > Hercules is 3.11 on OpenSuse LEAP 42.x 64-bit.
>> > The error I get is "The Linux kernel requires more recent processor
>> > hardware."
>> > HHCCP011I CPU: Disabled wait state
>> > PSW=0002 8000 BAD
>> >
>> > Is there a minimum Hercules requirement?
>> > Or is it something I might find in the Hercules config file? I have
>> z/ARCH
>> > specified.
>>
>> I don't think it's a Hercules requirement, necessarily.  Ubuntu requires a
>> zEC12 or later machine to run.  If you can get Hercules to report that,
>> then you should be OK.
>>
>>
>> Mark Post
>>
>> --
>> For LINUX-390 subscribe / signoff / archive access instructions,
>> send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or
>> visit
>> http://www.marist.edu/htbin/wlvindex?LINUX-390
>> --
>> For more information on Linux on System z, visit
>> http://wiki.linuxvm.org/
>>
>
> --
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
> --
> For more information on Linux on System z, visit
> http://wiki.linuxvm.org/

--
Regards,

Dimitri.

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: UBUNTU on HERCULES

2016-06-23 Thread Tom Huegel
Thanks Mark,
I'm telling Hercules it is s z13 (2964 N30) but I don't know that Hercules
does anything with that other than reflect it in the STSI instruction...
How does UBUNTU determine the hardware level?

Tom

On Thu, Jun 23, 2016 at 2:14 PM, Mark Post  wrote:

> >>> On 6/23/2016 at 04:42 PM, Tom Huegel  wrote:
> > I am having a problem trying to install UBUNTU s390x on Hercules.
> > Hercules is 3.11 on OpenSuse LEAP 42.x 64-bit.
> > The error I get is "The Linux kernel requires more recent processor
> > hardware."
> > HHCCP011I CPU: Disabled wait state
> > PSW=0002 8000 BAD
> >
> > Is there a minimum Hercules requirement?
> > Or is it something I might find in the Hercules config file? I have
> z/ARCH
> > specified.
>
> I don't think it's a Hercules requirement, necessarily.  Ubuntu requires a
> zEC12 or later machine to run.  If you can get Hercules to report that,
> then you should be OK.
>
>
> Mark Post
>
> --
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or
> visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
> --
> For more information on Linux on System z, visit
> http://wiki.linuxvm.org/
>

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: $SECONDS Varible in Ubuntu

2016-06-23 Thread John Campbell
U...

Don't mind me, but...

SOJ=${SECONDS}
# do something that takes time, like a SQL query
TOJ=`expr ${SECONDS} - ${SOJ}`

... which works for me on Mint, a deviant of Ubuntu.  (It even works in
MobaXterm)

H... this even works on Solaris, though it seems that SECONDS is based
on when the shell was launched, so crossing midnight is unlikely to be a
problem.

That being said, the

NOW_EPOCH=`date +%s`

makes for a nice reference number if multiple scripts are playing... though
Solaris is unhappy with this, reporting %s on output rather than something
useful.

I'm a bit of a luddite so I prefer the backticks and an expr to make this
more "readable" to geezers like myself.

-soup

On Thu, Jun 23, 2016 at 3:28 PM, Rafael David Tinoco <
rafael.tin...@canonical.com> wrote:

> ​
> Sorry last email got all messed up,
> $ /bin/bash -c 'echo $SECONDS; echo $(($SECONDS-10))'
> 0
> -10
> $ /bin/sh -c 'echo $SECONDS; echo $(($SECONDS-10))'
>
> -10
>
> "/bin/sh" comes from "dash" - used in Ubuntu/Debian - and it doesn't
>
> implement $SECONDS as it looks like. With that said, you should rely
>
> on something like "timeoftheday":
>
> $ date +%s
> 1466709830
>
> ( date man page ==  %s seconds since 1970-01-01 00:00:00 UTC)You can
> get the difference from the beginning of the execution to the end on
> something more reliable.
>
> Hope that helps you...
>
> On Thu, Jun 23, 2016 at 9:11 AM, burgess, christopher <
> christopher.burg...@emc.com> wrote:
>
> > Hi,
> > I am having an issue with a script running on an Ubuntu
> > 16.04 guest. The script uses the variable to test how long the script has
> > been running. It works fine on Rhel and Sles. However when I run it on
> > Ubuntu, the variable never picks up a value. If I initialize it to zero,
> it
> > stays at zero. However doing `echo $SECONDS` displays a nonzero value.
> > Below are the results of the script on Ubuntu and Sles. I appreciate any
> > feedback.
> >
> > Ubuntu:
> > root@vm63fcpu1604rya5:/extra# ./seconds.sh
> > seconds at start:
> > ./seconds.sh: 6: ./seconds.sh: arithmetic expression: expecting primary:
> "
> > - "
> > root@vm63fcpu1604rya5:/extra# cat seconds.sh
> > #!/bin/sh
> > START_TIME=$SECONDS
> > echo 'seconds at start:' $SECONDS
> > sleep 10
> >
> > ELAPSED_TIME=$(($SECONDS - $START_TIME))
> >
> > echo "$(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec"
> > root@vm63fcpu1604rya5:/extra#
> >
> > Sles12 SP1:
> > vm63fcps12sp1rya5:/extra # ./seconds.sh
> > seconds at start: 0
> > 0 min 10 sec
> > vm63fcps12sp1rya5:/extra #
> >
> >
> > Thanks,
> > Chris Burgess
> >
> >
> > --
> > For LINUX-390 subscribe / signoff / archive access instructions,
> > send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or
> > visit
> > http://www.marist.edu/htbin/wlvindex?LINUX-390
> > --
> > For more information on Linux on System z, visit
> > http://wiki.linuxvm.org/
> >
>
>
>
> --
> Rafael David Tinoco
> Canonical - Kernel & Userland Sustaining Engineer
> Server Tech Lead for SEG - Manager: Brooks Warner
> # Email: rafael.tin...@canonical.com (GPG: 2B15B499)
> # LP: ~inaddy | IRC: tinoco
>
> --
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or
> visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
> --
> For more information on Linux on System z, visit
> http://wiki.linuxvm.org/
>



-- 
John R. Campbell Speaker to Machines  souperb at gmail dot
com
MacOS X proved it was easier to make Unix user-friendly than to fix Windows
"It doesn't matter how well-crafted a system is to eliminate errors;
Regardless
 of any and all checks and balances in place, all systems will fail because,
 somewhere, there is meat in the loop." - me

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: $SECONDS Varible in Ubuntu

2016-06-23 Thread Mark Post
>>> On 6/23/2016 at 04:21 PM, "burgess, christopher" 
>>> 
wrote: 
> Funny thing is Mark, I thought it was using bash:
> 
> root@vm63fcpu1604rya5:/extra# echo $SHELL
> /bin/bash
> root@vm63fcpu1604rya5:/extra#

That's the shell you're running, but as others pointed out, /bin/sh doesn't 
point to bash, but to dash.  So, when you put #!/bin/sh on the first line, you 
get dash, not bash.

I don't know if Ubuntu has any sort of "alternatives" that would allow you to 
modify that default.


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: UBUNTU on HERCULES

2016-06-23 Thread Mark Post
>>> On 6/23/2016 at 04:42 PM, Tom Huegel  wrote: 
> I am having a problem trying to install UBUNTU s390x on Hercules.
> Hercules is 3.11 on OpenSuse LEAP 42.x 64-bit.
> The error I get is "The Linux kernel requires more recent processor
> hardware."
> HHCCP011I CPU: Disabled wait state
> PSW=0002 8000 BAD
> 
> Is there a minimum Hercules requirement?
> Or is it something I might find in the Hercules config file? I have z/ARCH
> specified.

I don't think it's a Hercules requirement, necessarily.  Ubuntu requires a 
zEC12 or later machine to run.  If you can get Hercules to report that, then 
you should be OK.


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: $SECONDS Varible in Ubuntu

2016-06-23 Thread burgess, christopher
Funny thing is Mark, I thought it was using bash:

root@vm63fcpu1604rya5:/extra# echo $SHELL
/bin/bash
root@vm63fcpu1604rya5:/extra#

Thanks,
Chris Burgess
Phone: 1-800-445-2588 x42149
   1-508-249-2149
Fax: 1-508-497-8027
Email: christopher.burg...@emc.com


-Original Message-
From: Linux on 390 Port [mailto:LINUX-390@VM.MARIST.EDU] On Behalf Of Mark Post
Sent: Thursday, June 23, 2016 3:13 PM
To: LINUX-390@VM.MARIST.EDU
Subject: Re: $SECONDS Varible in Ubuntu

>>> On 6/23/2016 at 08:11 AM, "burgess, christopher" 
>>> 
wrote: 
> Hi,
> I am having an issue with a script running on an 
> Ubuntu
> 16.04 guest. The script uses the variable to test how long the script 
> has been running. It works fine on Rhel and Sles. However when I run 
> it on Ubuntu, the variable never picks up a value. If I initialize it 
> to zero, it stays at zero. However doing `echo $SECONDS` displays a 
> nonzero value. Below are the results of the script on Ubuntu and Sles. I 
> appreciate any feedback.

What shell are you running?  IIRC, Ubuntu doesn't use bash as the default.


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions, send email to 
lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit http://wiki.linuxvm.org/

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


UBUNTU on HERCULES

2016-06-23 Thread Tom Huegel
I am having a problem trying to install UBUNTU s390x on Hercules.
Hercules is 3.11 on OpenSuse LEAP 42.x 64-bit.
The error I get is "The Linux kernel requires more recent processor
hardware."
HHCCP011I CPU: Disabled wait state
PSW=0002 8000 BAD

Is there a minimum Hercules requirement?
Or is it something I might find in the Hercules config file? I have z/ARCH
specified.

Thanks for any help or suggestions.
Tom

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: $SECONDS Varible in Ubuntu

2016-06-23 Thread burgess, christopher
Thanks Fernando, that did the trick. I have a number of old scripts that I copy 
and modify. I will have to convert them now.

Thanks,
Chris Burgess
Phone: 1-800-445-2588 x42149
   1-508-249-2149
Fax: 1-508-497-8027
Email: christopher.burg...@emc.com

-Original Message-
From: Linux on 390 Port [mailto:LINUX-390@VM.MARIST.EDU] On Behalf Of Fernando 
Gieseler
Sent: Thursday, June 23, 2016 3:12 PM
To: LINUX-390@VM.MARIST.EDU
Subject: Re: $SECONDS Varible in Ubuntu

Try to change #!/bin/sh to #!/bin/bash 

Can be a bash problem. 

Kind regards,


--
Fernando Gieseler
fgiese...@gmail.com
05199888177

Enviado do meu iPhone

> Em 23 de jun de 2016, às 09:11, burgess, christopher 
>  escreveu:
> 
> Hi,
>I am having an issue with a script running on an Ubuntu 16.04 
> guest. The script uses the variable to test how long the script has been 
> running. It works fine on Rhel and Sles. However when I run it on Ubuntu, the 
> variable never picks up a value. If I initialize it to zero, it stays at 
> zero. However doing `echo $SECONDS` displays a nonzero value. Below are the 
> results of the script on Ubuntu and Sles. I appreciate any feedback.
> 
> Ubuntu:
> root@vm63fcpu1604rya5:/extra# ./seconds.sh seconds at start:
> ./seconds.sh: 6: ./seconds.sh: arithmetic expression: expecting primary: " - "
> root@vm63fcpu1604rya5:/extra# cat seconds.sh #!/bin/sh 
> START_TIME=$SECONDS echo 'seconds at start:' $SECONDS sleep 10
> 
> ELAPSED_TIME=$(($SECONDS - $START_TIME))
> 
> echo "$(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec"
> root@vm63fcpu1604rya5:/extra#
> 
> Sles12 SP1:
> vm63fcps12sp1rya5:/extra # ./seconds.sh seconds at start: 0
> 0 min 10 sec
> vm63fcps12sp1rya5:/extra #
> 
> 
> Thanks,
> Chris Burgess
> 
> 
> --
> For LINUX-390 subscribe / signoff / archive access instructions, send 
> email to lists...@vm.marist.edu with the message: INFO LINUX-390 or 
> visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
> --
> For more information on Linux on System z, visit 
> http://wiki.linuxvm.org/

--
For LINUX-390 subscribe / signoff / archive access instructions, send email to 
lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit http://wiki.linuxvm.org/


Re: $SECONDS Varible in Ubuntu

2016-06-23 Thread Rafael David Tinoco
​
Sorry last email got all messed up,
$ /bin/bash -c 'echo $SECONDS; echo $(($SECONDS-10))'
0
-10
$ /bin/sh -c 'echo $SECONDS; echo $(($SECONDS-10))'

-10

"/bin/sh" comes from "dash" - used in Ubuntu/Debian - and it doesn't

implement $SECONDS as it looks like. With that said, you should rely

on something like "timeoftheday":

$ date +%s
1466709830

( date man page ==  %s seconds since 1970-01-01 00:00:00 UTC)You can
get the difference from the beginning of the execution to the end on
something more reliable.

Hope that helps you...

On Thu, Jun 23, 2016 at 9:11 AM, burgess, christopher <
christopher.burg...@emc.com> wrote:

> Hi,
> I am having an issue with a script running on an Ubuntu
> 16.04 guest. The script uses the variable to test how long the script has
> been running. It works fine on Rhel and Sles. However when I run it on
> Ubuntu, the variable never picks up a value. If I initialize it to zero, it
> stays at zero. However doing `echo $SECONDS` displays a nonzero value.
> Below are the results of the script on Ubuntu and Sles. I appreciate any
> feedback.
>
> Ubuntu:
> root@vm63fcpu1604rya5:/extra# ./seconds.sh
> seconds at start:
> ./seconds.sh: 6: ./seconds.sh: arithmetic expression: expecting primary: "
> - "
> root@vm63fcpu1604rya5:/extra# cat seconds.sh
> #!/bin/sh
> START_TIME=$SECONDS
> echo 'seconds at start:' $SECONDS
> sleep 10
>
> ELAPSED_TIME=$(($SECONDS - $START_TIME))
>
> echo "$(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec"
> root@vm63fcpu1604rya5:/extra#
>
> Sles12 SP1:
> vm63fcps12sp1rya5:/extra # ./seconds.sh
> seconds at start: 0
> 0 min 10 sec
> vm63fcps12sp1rya5:/extra #
>
>
> Thanks,
> Chris Burgess
>
>
> --
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or
> visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
> --
> For more information on Linux on System z, visit
> http://wiki.linuxvm.org/
>



-- 
Rafael David Tinoco
Canonical - Kernel & Userland Sustaining Engineer
Server Tech Lead for SEG - Manager: Brooks Warner
# Email: rafael.tin...@canonical.com (GPG: 2B15B499)
# LP: ~inaddy | IRC: tinoco

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: $SECONDS Varible in Ubuntu

2016-06-23 Thread Rafael David Tinoco
$ /bin/bash -c 'echo $SECONDS; echo $(($SECONDS-10))' 0 -10 $ /bin/sh
-c 'echo $SECONDS; echo $(($SECONDS-10))'   -10 "/bin/sh" comes
from "dash" - used in Ubuntu/Debian - and it doesn't implement
$SECONDS as it looks like. With that said, you should rely on
something like "timeoftheday": $ date +%s 1466709830 Hope that helps
you... On Thu, Jun 23, 2016 at 9:11 AM, burgess, christopher
christopher.burg...@emc.com wrote: >

Hi,

I am having an issue with a script running on an
Ubuntu 16.04 guest. The script uses the variable to test how long the
script has been running. It works fine on Rhel and Sles. However when
I run it on Ubuntu, the variable never picks up a value. If I
initialize it to zero, it stays at zero. However doing echo $SECONDS
displays a nonzero value. Below are the results of the script on
Ubuntu and Sles. I appreciate any feedback.

>

Ubuntu:

root@vm63fcpu1604rya5:/extra# ./seconds.sh

seconds at start:

./seconds.sh: 6: ./seconds.sh: arithmetic expression: expecting primary: " - "

root@vm63fcpu1604rya5:/extra# cat seconds.sh

!/bin/sh

START_TIME=$SECONDS

echo 'seconds at start:' $SECONDS

sleep 10

>

ELAPSEDTIME=$(($SECONDS - $STARTTIME))

>

echo "$(($ELAPSEDTIME/60)) min $(($ELAPSEDTIME%60)) sec"

root@vm63fcpu1604rya5:/extra#

>

Sles12 SP1:

vm63fcps12sp1rya5:/extra # ./seconds.sh

seconds at start: 0

0 min 10 sec

vm63fcps12sp1rya5:/extra #

> >

Thanks,

Chris Burgess

> >



For LINUX-390 subscribe / signoff / archive access instructions,

send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit

http://www.marist.edu/htbin/wlvindex?LINUX-390



For more information on Linux on System z, visit

http://wiki.linuxvm.org/

-- Rafael David Tinoco Canonical - Kernel & Userland Sustaining
Engineer Server Tech Lead for SEG - Manager: Brooks Warner

Email: rafael.tin...@canonical.com (GPG: 2B15B499)

LP: ~inaddy | IRC: tinoco

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Re: $SECONDS Varible in Ubuntu

2016-06-23 Thread Mark Post
>>> On 6/23/2016 at 08:11 AM, "burgess, christopher" 
>>> 
wrote: 
> Hi,
> I am having an issue with a script running on an Ubuntu 
> 16.04 guest. The script uses the variable to test how long the script has 
> been running. It works fine on Rhel and Sles. However when I run it on 
> Ubuntu, the variable never picks up a value. If I initialize it to zero, it 
> stays at zero. However doing `echo $SECONDS` displays a nonzero value. Below 
> are the results of the script on Ubuntu and Sles. I appreciate any feedback.

What shell are you running?  IIRC, Ubuntu doesn't use bash as the default.


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
--
For more information on Linux on System z, visit
http://wiki.linuxvm.org/