Entitas icon indicating copy to clipboard operation
Entitas copied to clipboard

jenny-server in launchd

Open dekstrin opened this issue 5 years ago • 5 comments

Hi,

I'm trying to run jenny-server in launchd agent with plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>UserName</key>
    <string>someUser</string>
    <key>Label</key>
    <string>org.jenny.server.android</string>

    <key>OnDemand</key>
    <false/>

    <key>Program</key>
    <string>Jenny-Server-CI.sh</string>

    <key>StandardOutPath</key>
    <string>/Users/someUser/jenny-server.log</string>
    <key>StandardErrorPath</key>
    <string>/Users/someUser/jenny-server.log</string>
    <key>Debug</key>
    <true/>
    <key>RunAtLoad</key>
    <true/>

  </dict>
</plist>

Jenny-Server-CI.sh :

#!/bin/bash
dir="$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)"
cd $dir
mono ./Jenny/Jenny.exe server -v

But I have got an error:

Server is listening on port 3333...
System.ArgumentNullException: String reference not set to an instance of a String.
Parameter name: s
  at System.Text.Encoding.GetBytes (System.String s) [0x00012] in <98fac219bd4e453693d76fda7bd96ab0>:0
  at DesperateDevs.CodeGeneration.CodeGenerator.CLI.ServerCommand.run () [0x00053] in <4647201ffb6143e68baac8394fa07ed6>:0
  at DesperateDevs.CLI.Utils.AbstractCommand.Run (DesperateDevs.CLI.Utils.CLIProgram program, System.String[] args) [0x0001f] in <956573764fa84708b5a09251d8da5b7c>:0
  at DesperateDevs.Serialization.CLI.Utils.AbstractPreferencesCommand.Run (DesperateDevs.CLI.Utils.CLIProgram program, System.String[] args) [0x00090] in <e4288bf908654abbb8e8bd7764619615>:0
  at DesperateDevs.CLI.Utils.CLIProgram.runCommand (System.String[] args) [0x0000e] in <956573764fa84708b5a09251d8da5b7c>:0

It's working fine without launchd. Maybe you could help me to find the root cause.

Cheers

dekstrin avatar Dec 19 '18 15:12 dekstrin

Hi, not sure if that's a good idea. Starting jenny server initially reads a Jenny.properties. Based on this file it initializes everything like listening on the specified port and parsing the specified project.

Usually you run jenny from the same folder where the properties file is located. This way you can specify relative paths instead of absolute paths in the properties, which you need to do when working in a team or on different machines. You can also run multiple instances on different ports per project. When you start a agent like this you'd need to hardcode it to a certain project, I don't think that's what you want?

sschmid avatar Dec 19 '18 17:12 sschmid

Or wait, I need to check if you can pass in different properties files like jenny client gen Jenny.proeprties maybe this could work, need to check first though

sschmid avatar Dec 19 '18 17:12 sschmid

But to keep it simple, I'd suggest to run one separate instance per project

sschmid avatar Dec 19 '18 17:12 sschmid

Thx for your help! But why I have "String reference not set to an instance of a String." only if I run jenny in launchd? Basically I need this for a Jenkins builds. I want to start Jenny before the build and stop after.

dekstrin avatar Dec 20 '18 08:12 dekstrin

Problem with launchd anyway fixed by itself after update to macos 10.13.6

dekstrin avatar Dec 27 '18 13:12 dekstrin