Figuring out the launch problem from the log - go-cd

This is very similar it seems, to
discover-why-godc-wont-start-on-mac but I Can't comment and what I have isn't an answer so
I'm opening a new question.
I have this problem where the Go Agent won't stay running on my Mac. It launches and then quickly exits. The log seems like a java issue but I have Java 8 and then also tried java 11, and neither worked. Here is the output of the log, but I cannot figure out if the version of Java is the issue or if it's something else.
``` Thu Jan 10 14:19:50 EST 2019: Setting working directory: /Users/buildadmin/Library/Application Support/Go Agent
Thu Jan 10 14:19:50 EST 2019: Setting environment variables:
AGENT_STARTUP_ARGS="-Xms128m -Xmx256m"
Thu Jan 10 14:19:50 EST 2019: Final environment variables are:
AGENT_STARTUP_ARGS=-Xms128m -Xmx256m
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.WzPSMYxWM1/Render
HOME=/Users/buildadmin
LOGNAME=buildadmin
OLDPWD=/
PATH=/usr/bin:/bin:/usr/sbin:/sbin
PWD=/Users/buildadmin/Library/Application Support/Go Agent
SHELL=/bin/bash
SHLVL=1
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.42xu8T62mh/Listeners
TMPDIR=/var/folders/_c/qfw_0cs93kq1ylslsh82llnr0000gp/T/
USER=buildadmin
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
_=/usr/bin/env
__CF_USER_TEXT_ENCODING=0x1F6:0x0:0x0
Thu Jan 10 14:19:50 EST 2019: Running:
Thu Jan 10 14:19:50 EST 2019: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/bin/java
Thu Jan 10 14:19:50 EST 2019: -cp
Thu Jan 10 14:19:50 EST 2019: /Users/buildadmin/Desktop/Go Agent.app/Contents/Resources/agent-bootstrapper.jar
Thu Jan 10 14:19:50 EST 2019: -Xdock:icon=/Users/buildadmin/Desktop/Go Agent.app/Contents/Resources/go-agent.icns
Thu Jan 10 14:19:50 EST 2019: -Xdock:name=Go Agent
Thu Jan 10 14:19:50 EST 2019: -Dgo.application.name=Go Agent
Thu Jan 10 14:19:50 EST 2019: -Dgo.java.to.use=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/bin/java
Thu Jan 10 14:19:50 EST 2019: -Dcruise.server.port=8153
Thu Jan 10 14:19:50 EST 2019: -Dcom.apple.mrj.application.apple.menu.about.name=Go Agent
Thu Jan 10 14:19:50 EST 2019: -Dapple.laf.useScreenMenuBar=true
Thu Jan 10 14:19:50 EST 2019: -Done-jar.main.class=com.thoughtworks.go.agent.bootstrapper.osx.AgentMacWindow
Thu Jan 10 14:19:50 EST 2019: -Dcruise.server.host=127.0.0.1
Thu Jan 10 14:19:50 EST 2019: com.simontuffs.onejar.Boot
Thu Jan 10 14:19:50 EST 2019: 127.0.0.1 8153
logFile Environment Variable= null
Logging to go-agent-bootstrapper.log
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.simontuffs.onejar.Boot.run(Boot.java:306)
at com.simontuffs.onejar.Boot.main(Boot.java:159)
Caused by: java.lang.NoSuchMethodError: com.apple.eawt.Application.setEnabledPreferencesMenu(Z)V
at com.thoughtworks.go.agent.bootstrapper.osx.AgentMacWindow.initializeApplicationAdapter(AgentMacWindow.java:76)
at com.thoughtworks.go.agent.bootstrapper.osx.AgentMacWindow.<init>(AgentMacWindow.java:65)
at com.thoughtworks.go.agent.bootstrapper.osx.AgentMacWindow.main(AgentMacWindow.java:47)
... 6 more

The problem was discovered to be the version of Java JDK that was installed. Apparently the GOCD agent doesn't like the latest version of the JDK so I downgraded to version 8 and everything kicked into gear. Thanks for all the suggestions.

Related

AWS cron expression to run every other Monday

I want to schedule a CloudWatch event to run every other Monday and have started with this command:
0 14 ? * 2 *
Currently with the above command, I get a weekly schedule of Monday executions:
Mon, 27 Jul 2020 14:00:00 GMT
Mon, 03 Aug 2020 14:00:00 GMT
Mon, 10 Aug 2020 14:00:00 GMT
Mon, 17 Aug 2020 14:00:00 GMT
Mon, 24 Aug 2020 14:00:00 GMT
Mon, 31 Aug 2020 14:00:00 GMT
Mon, 07 Sep 2020 14:00:00 GMT
Mon, 14 Sep 2020 14:00:00 GMT
Mon, 21 Sep 2020 14:00:00 GMT
Mon, 28 Sep 2020 14:00:00 GMT
However, I would like the schedule to be set to every other Monday, e.g.
Mon, 27 Jul 2020 14:00:00 GMT
Mon, 10 Aug 2020 14:00:00 GMT
Mon, 24 Aug 2020 14:00:00 GMT
Mon, 07 Sep 2020 14:00:00 GMT
Mon, 21 Sep 2020 14:00:00 GMT
I have seen examples with exp and # being used, but I don't think AWS CloudWatch events accept these sort of parameters.
Chris' answer is correct. Currently, there is no way that I could think of to express this as part of CloudWatch Scheduled Events.
However, a workaround could be to set it to every Monday (0 14 ? * 2 *) and trigger a Lambda function that checks whether it's in the on-week or the off-week before triggering the actual target.
Even though this adds some complexity, it would be a viable solution.
You won't be able to do any of the fancier commands (especially those using variables from the command line).
You could do this very basically but would require 2 separate events in order to carry it out:
0 14 ? * 2#1 * - Run on the first Monday of the month.
0 14 ? * 2#3 * - Run on the third Monday of the month.
Unfortunately there is no compatible syntax for scheduled expressions that would allow the concept of every other week, so the above commands occasionally could lead to a 3 week gap.
If you don't care about the Monday you could of course use 0 14 1,15 * * to run on the 1st and 15th of each month (roughly every 2 weeks).
The final option would be to run every Monday, but have the script exit if it is not the every other week, the expression would then just be 0 14 ? * 2 *.
More information about the syntax is available on the Cron Expressions section of the Scheduled Events page.

Running Total Over Multiple Years

I have an Orders fact table and a connected Date dimension.
I'd like to create a running total measure by year and month, but for the current year I only want it to total up to the current date and then be blank afterwards. I'll be turning it into a bar graph and I don't want the plateau that will happen as it calculates each month that hasn't happened yet as the current YTD value.
I'm coming from a SQL background where this would be an easy task, but seems difficult in power bi/dax.
I'm currently working with the following dax:
SalesRT_NEW =
IF (
MONTH ( TODAY () ) <= MAX ( DimDate[Date] ),
TOTALYTD ( SUM ( 'FactOrderDetails(3yr)'[LineTotal] ), DimDate[Date] ),
BLANK ()
)
Output (as table for testing) is (starting from June for brevities sake):
YEAR Month SalesRT
2017 Jun 1500
2018 Jun 1750
2019 Jun 1900
2017 Jul 1650
2018 Jul 1858
2019 Jul 2050
2017 Aug 1800
2018 Aug 1965
2019 Aug 2050
Desired output:
YEAR Month SalesRT
2017 Jun 1500
2018 Jun 1750
2019 Jun 1900
2017 Jul 1650
2018 Jul 1858
2019 Jul 2050
2017 Aug 1800
2018 Aug 1965
2019 Aug
Got the answer:
IF(MAX(DimDate[Date]) <= today() || MONTH(MAX(DimDate[Date])) = Month(today()),TOTALYTD([SalesTotal], DimDate[Date]), BLANK())

RegEx: Match Within Bounded Groups

I need to match carriage-returns in blocks of text between a pre-determined tag and an indeterminate tag.
In this case, the bounding tags are:
Pre-determined: X-Gmail-Labels:
Indeterminate: (?:^[\w\-]+:) eg: Delivered-To: or ABC123:
Thanks to Wiktor Stribiżew for his answer to this thread, I have a rough idea of the solution I should pursue.
I am unsure of how to apply what I believe is needed: an uncaptured lookahead group for the bounding indeterminate tag.
Plainly stated, I'd like to delete all the carriage-returns in the text associated with the X-Gmail-Labels:. If I can match them, I can delete them!
Initial attempted regex:
(?:\bX-Gmail-Labels:|(?!^)\G)[^\r]*\K\r
Sample data:
From 1604610346950104244#xxx Fri Jun 29 12:34:35 +0000 2018
X-GM-THRID: 1604610346950104244
X-Gmail-Labels: Archived thing,Unread
Delivered-To: joe.schmoe#gmail.com
Received: by 2002:a9f:3005:0:0:0:0:0 with SMTP id h5-v6csp731836uab;
Fri, 29 Jun 2018 05:34:36 -0700 (PDT)
From 1604610346950104244#xxx Fri Jun 29 12:34:35 +0000 2018
X-GM-THRID: 1604610346950104244
X-Gmail-Labels: Also Archived
Day-of-week: Tuesday
Received: by 2002:a9f:3005:0:0:0:0:0 with SMTP id h5-v6csp731836uab;
Fri, 29 Jun 2018 05:34:36 -0700 (PDT)
From 1604610346950104244#xxx Fri Jun 29 12:34:35 +0000 2018
X-GM-THRID: 1604610346950104244
X-Gmail-Labels: Archived
thing,
Unread
Favorite-fruit: bananas
Received: by 2002:a9f:3005:0:0:0:0:0 with SMTP id h5-v6csp731836uab;
Fri, 29 Jun 2018 05:34:36 -0700 (PDT)
From 1604610346950104244#xxx Fri Jun 29 12:34:35 +0000 2018
X-GM-THRID: 1604610346950104244
X-Gmail-Labels: Archived
,Read
ABC123: DoReMe
Received: by 2002:a9f:3005:0:0:0:0:0 with SMTP id h5-v6csp731836uab;
Fri, 29 Jun 2018 05:34:36 -0700 (PDT)
From 1604610346950104244#xxx Fri Jun 29 12:34:35 +0000 2018
X-GM-THRID: 1604610346950104244
X-Gmail-Labels: Archived
thing,Unread
emais
Received: by 2002:a9f:3005:0:0:0:0:0 with SMTP id h5-v6csp731836uab;
Fri, 29 Jun 2018 05:34:36 -0700 (PDT)
(?:^[\w\-]+:)
Above regex applied to data showing indeterminate tag pattern.
(?:\bX-Gmail-Labels:\G)[^\r]*\K\r
Above regex applied to data showing un-end-bounded matches.
Thanks!
-Fitz

How to grep lines with date formats?

I have a log file that is created from a bash script that uses $(date), so there are dates in such a format:
Fri Apr 24 22:10:39 CEST 2015
The log file looks like this:
Using SCRIPTS_ROOTDIR: /home/gillin/moses/scripts
Using multi-thread GIZA
using gzip
(1) preparing corpus # Fri Apr 24 22:10:39 CEST 2015
Executing: mkdir -p /media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus
(1.0) selecting factors # Fri Apr 24 22:10:39 CEST 2015
Forking...
(1.2) creating vcb file /media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus/en.vcb # Fri Apr 24 22:10:39 CEST 2015
(1.1) running mkcls # Fri Apr 24 22:10:39 CEST 2015
/home/gillin/moses/training-tools/mkcls -c50 -n2 -p/media/2tb/ccexp/corpus.exp/train-clean.en -V/media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus/en.vcb.classes opt
Executing: /home/gillin/moses/training-tools/mkcls -c50 -n2 -p/media/2tb/ccexp/corpus.exp/train-clean.en -V/media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus/en.vcb.classes opt
(1.1) running mkcls # Fri Apr 24 22:10:39 CEST 2015
/home/gillin/moses/training-tools/mkcls -c50 -n2 -p/media/2tb/ccexp/corpus.exp/train-clean.ru -V/media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus/ru.vcb.classes opt
Executing: /home/gillin/moses/training-tools/mkcls -c50 -n2 -p/media/2tb/ccexp/corpus.exp/train-clean.ru -V/media/2tb/ccexp/phrase-clustercat-mgiza/work.en-ru/training/corpus/ru.vcb.classes opt
Is there a way such that i can grep all the lines that contain the output of $(date)?
Currently I'm using this regex:
[a-z].*[1-9] [0-2][1-9]:[0-6][0-9]:[0-6][0-9] CEST 2015
And it catches line like
preparing corpus # Fri Apr 24 22:10:39 CEST 2015
But i need the full line:
(1) preparing corpus # Fri Apr 24 22:10:39 CEST 2015
And also the year and time is sort of hard coded. Is there a better regex or unix tool that can extract lines with $(date) outputs?
Try this:
unalias grep
grep --color=never '.*[a-z].*[1-9] [0-2][1-9]:[0-6][0-9]:[0-6][0-9] CEST 2015' file

Confusion on grep pattern search

Consider this log file
SN PID Date Status
1 P01 Fri Feb 14 19:32:36 IST 2014 Alive
2 P02 Fri Feb 14 19:32:36 IST 2014 Alive
3 P03 Fri Feb 14 19:32:36 IST 2014 Alive
4 P04 Fri Feb 14 19:32:36 IST 2014 Alive
5 P05 Fri Feb 14 19:32:36 IST 2014 Alive
6 P06 Fri Feb 14 19:32:36 IST 2014 Alive
7 P07 Fri Feb 14 19:32:36 IST 2014 Alive
8 P08 Fri Feb 14 19:32:36 IST 2014 Alive
9 P09 Fri Feb 14 19:32:36 IST 2014 Alive
10 P010 Fri Feb 14 19:32:36 IST 2014 Alive
When i do => grep "P01" File
output is : (as expected)
1 P01 Fri Feb 14 19:32:36 IST 2014 Alive
10 P010 Fri Feb 14 19:32:36 IST 2014 Alive
But when i do => grep " P01 " File (notice the space before and after P01)
I do not get any output!
Question : grep matches pattern in a line, so " P01 " ( with space around ) should match the first PID of P01 as it has spaces around it....but seems that this logic is wrong....what obvious thing i am missing here!!!?
If the log uses tabs not spaces, your grep pattern won't match. I would add word boundaries to the word you want to find:
grep '\<P01\>' file
If you really want to use whitespace in your pattern, use one of:
grep '[[:blank:]]P01[[:blank:]]' file # horizontal whitespace, tabs and spaces
grep -P '\sP01\s' file # using Perl regex