Change Port using Jenkins-lts Homebrew - macos

I was wondering how one could change Jenkins-lts default port 8080 on Mac using Homebrew Installation. Actually I have 2 folders one on :
/Users/XXXXXX/.jenkins/ In here after execute all the process still runing on Port:8080
/usr/local/Cellar/jenkins/ In here when I executed the process jenkins running on Port:8383 but any jobs work.
I took the example for other Stack Member Ifeego answered Aug 21 '18 at 8:55, This is what I did:
I have installed Jenkins LTS by brew command:
brew install jenkins-lts
So my Jenkins plist file is here:
/usr/local/Cellar/jenkins-lts/2.121.2/homebrew.mxcl.jenkins-lts.plist
You can modify the httpPort value from default 8080 to the other value,and then save the file.
Label
homebrew.mxcl.jenkins-lts
ProgramArguments
/usr/libexec/java_home
-v
1.8
--exec
java
-Dmail.smtp.starttls.enable=true
-jar
/usr/local/opt/jenkins-lts/libexec/jenkins.war
--httpListenAddress=127.0.0.1
--httpPort=8383
RunAtLoad
sudo launchctl unload command will not work for you. You must try these commands to restart your Jenkins and make the port modification works.
After executed the change on jenkins-lts.plist file:
brew services stop jenkins-lts
brew services start jenkins-lts
ifeegoo:~ ifeegoo$ brew services stop jenkins-lts
Stopping `jenkins-lts`... (might take a while)
==> Successfully stopped `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)
ifeegoo:~ ifeegoo$ brew services start jenkins-lts
==> Successfully started `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)
Note:When I open the terminal and run brew services start jenkins-lts jenkins go up using the new Port:8383 in these case they do not run any job, but when I run on the terminal the command: jenkins-lts the application up in the Port:8080 and here I can run all the Jobs without troubles.

Related

Why is spotifyd daemon failing to start

Every time I run the command brew services start spotifyd on my terminal, the error Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/homefolder/Library/LaunchAgents/homebrew.mxcl.spotifyd.plist` exited with 5. appears, preventing me from using the service.
I have tried:
sudo launchctl stop /Library/LaunchDaemons/rustlang.spotifyd.plist followed by sudo launchctl unload -w /Library/LaunchDaemons/rustlang.spotifyd.plist and then sudo launchctl load -w /Library/LaunchDaemons/rustlang.spotifyd.plist followed by sudo launchctl start /Library/LaunchDaemons/rustlang.spotifyd.plist and finally brew services restart spotifyd
But the issue remains
Well, I ended up finding a solution to the issue... running the command brew services restart spotifyd as root, meaning sudo brew services restart spotifyd actually allows for successful execution.

Cannot start jenkins-lts on mac using homebrew

I am trying to install/run jenkins on a mac machine using homebrew. This is what I did
brew install jenkins-lts
On running this command. I see that jenkins-lts is installed and I see this message
Note: When using launchctl the port will be 8080.
To have launchd start jenkins-lts now and restart at login:
brew services start jenkins-lts.
Or, if you don't want/need a background service you can just run:
jenkins-lts
If I run jenkins-lts, Jenkins starts at port 8080 successfully. I can reach it from the browser.
If I run brew services start jenkins-lts . I see the message
Successfully started jenkins-lts (label:homebrew.mxcl.jenkins-lts)
But I cannot reach the server on port 8080. I tried checking the status of the service
I tried checking the status of the service brew services list
Name Status User Plist
jenkins-lts unknown ec2-user /Users/ec2-user/Library/LaunchAgents/homebrew.mxcl.jenkins-lts.plist
I see that status is unknown.
After a while I see that this service is not listed anymore in the brew services list command. If I try to start it again. I see this message
/Users/ec2-user/Library/LaunchAgents/homebrew.mxcl.jenkins-lts.plist: service already loaded
Error: Failure while executing; /bin/launchctl bootstrap gui/501 /Users/ec2-user/Library/LaunchAgents/homebrew.mxcl.jenkins-lts.plist exited
with 37
Where can I find the jenkins logs and how to get it working.
likely you have not configured you host setings
so after starting the service
use
http://127.0.0.1:8080/
not
http://localhost:8080/
This is my experience , brew services list showed up as :
Name Status User Plist
jenkins-lts error cskjk16 /usr/local/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.#CD6R ~
and the fix was:
1. brew services stop jenkins-lts
2. brew services start jenkins-lts
and now brew services list showed up as :
Name Status User Plist
jenkins-lts started cskjk16 /usr/local/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.#CD6R ~
My solution was to uninstall Jenkins using brew (brew uninstall jenkins-lts), followed by brew doctor, followed by brew clanup, and re-install jenkins (brew install jenkins-lts).
After, I was able to start Jenkins using brew services start jenkins-lts.
Your password will be available at $ cat /User/..../.jenkins/secrets/initialAdminPassword.
Use it to create the admin account and continue the configuration.
The issue here is that, macos was running as a dedicated host on AWS.
I was connected to this macos from my windows machine using putty and trying to run the command.
brew services start jenkins-lts
This does not work. I had to login to macos via some Remote Desktop client like VNC and then run the same command from the the terminal window of mac.
In some cases, there will be a pop up which you needs user input. Hence this did not work when I was connected via putty from my windows machine.
We had the same issues on MacBooks and this is what fixed it.
run this:
chmod u+w /usr/local/var/log
and then run this:
sudu chown -R $(whoami) /usr/local/var/log
then:
brew install jenkins-lts
and it worked

Can't change document root for apache 2.4

I want to set up local web server using Apache and PHP on my Mac running Sierra. I followed this tutorial:
https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
And I am stuck at changing the document root from httpd.config, for whatever reason this change does not take effect at all. If I type http://localhost it still says "It works", it still uses the original html file.
Another weird thing is that apparently I can't stop apache at all. I tried running
$ sudo apachectl stop
but I still can’t access http://localhost
if I run
$ brew services list
httpd24 is stopped. What gives? What am I doing wrong?
There is an instance of apache pre-installed with macOS. So you have now two versions of apache installed. If you check:
which apachectl
you will probably obtain:
/usr/sbin/apachectl
which is the official macOS version of apachectl. Stop it with:
sudo apachectl stop
Disable the auto-loading of the pre-installed apache with (as explained in the tutorial you mentioned):
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
To run the homebrew version do:
brew services run httpd24
to stop it:
brew services stop httpd24
to register it to launch at login:
brew services start httpd24

How to shut down rethinkdb running on Mac OSX

Note: We love RethinkDB but our current project does not use it so we need to free up resources on our local machine ...
We installed RethinkDB using homebrew:
brew update && brew install rethinkdb
And added the rethinkdb process to our plist as per the instructions in:
http://rethinkdb.com/docs/start-on-startup/
But now we need to shut it down to free-up the 8080 port for another service.
What command do we need to run? (thanks!)
Do this in the terminal
check to see if you started it using brew
$ brew services list
stop rethinkdb:
$ brew services stop rethinkdb
restart:
$ brew services start rethinkdb
Like this, I think, if you used launchctl:
sudo launchctl unload -w /Library/LaunchDaemons/com.rethinkdb.server.plist

What's a clean way to stop mongod on Mac OS X?

i'm running mongo 1.8.2 and trying to see how to cleanly shut it down on Mac.
on our ubuntu servers i can shutdown mongo cleanly from the mongo shell with:
> use admin
> db.shutdownServer()
but on my Mac, it does not kill the mongod process. the output shows that it 'should be' shutdown but when i ps -ef | grep mongo it shows me an active process. also, i can still open a mongo shell and query my dbs like it was never shutdown.
the output from my db.shutdownServer() locally is:
MongoDB shell version: 1.8.2
connecting to: test
> use admin
switched to db admin
> db.shutdownServer()
Tue Dec 13 11:44:21 DBClientCursor::init call() failed
Tue Dec 13 11:44:21 query failed : admin.$cmd { shutdown: 1.0 } to: 127.0.0.1
server should be down...
Tue Dec 13 11:44:21 trying reconnect to 127.0.0.1
Tue Dec 13 11:44:21 reconnect 127.0.0.1 failed couldn't connect to server 127.0.0.1
Tue Dec 13 11:44:21 Error: error doing query: unknown shell/collection.js:150
i know i can just kill the process but i'd like to do it more cleanly.
It's probably because launchctl is managing your mongod instance. If you want to start and shutdown mongod instance, unload that first:
launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plist
Then start mongod manually:
mongod -f path/to/mongod.conf --fork
You can find your mongod.conf location from ~/Library/LaunchAgents/org.mongodb.mongod.plist.
After that, db.shutdownServer() would work just fine.
Added Feb 22 2014:
If you have mongodb installed via homebrew, homebrew actually has a handy brew services command. To show current running services:
brew services list
To start mongodb:
brew services start mongodb-community
To stop mongodb if it's already running:
brew services stop mongodb-community
Update*
As edufinn pointed out in the comment, brew services is now available as user-defined command and can be installed with following command: brew tap gapple/services.
If you installed mongodb with homebrew, there's an easier way:
List mongo job with launchctl:
launchctl list | grep mongo
Stop mongo job:
launchctl stop <job label>
(For me this is launchctl stop homebrew.mxcl.mongodb)
Start mongo job:
launchctl start <job label>
Simple way is to get the process id of mongodb and kill it.
Please note DO NOT USE kill -9 pid for this as it may cause damage to the database.
so,
1. get the pid of mongodb
$ pgrep mongo
you will get pid of mongo, Now
$ kill
You may use kill -15 as well
If you have installed mongodb community server via homebrew, then you can do:
brew services list
This will list the current services as below:
Name Status User Plist
mongodb-community started <your_user_name> /Users/<your_user_name>/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
redis stopped
Then you can restart mongodb by first stopping and restart:
brew services stop mongodb
brew services start mongodb
I prefer to stop the MongoDB server using the port command itself.
sudo port unload mongodb
And to start it again.
sudo port load mongodb
Check out these docs:
http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo#StartingandStoppingMongo-SendingaUnixINTorTERMsignal
If you started it in a terminal you should be ok with a ctrl + 'c' -- this will do a clean shutdown.
However, if you are using launchctl there are specific instructions for that which will vary depending on how it was installed.
If you are using Homebrew it would be launchctl stop homebrew.mxcl.mongodb
The solutions provided by others used to work for me but is not working for me anymore, which is as below.
brew services stop mongodb
brew services start mongodb
brew services list gives
Name Status User Plist
mongodb-community started XXXXXXXXX /Users/XXXXXXXXX/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
So I used mongodb-community instead of mongodb which worked for me
brew services stop mongodb-community
brew services start mongodb-community
This is an old question, but its one I found while searching as well.
If you installed with brew then the solution would actually be the this:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
If the service is running via brew, you can stop it using the following command:
brew services stop mongodb

Resources