当前位置: 首页 > others > 正文

MAC下修改被HP打印机占用的8080端口

Mac的8080端口被占了,查了一下是 HP printer agent 占用了8080端口,这是Tomcat, JBoss and others servlet engines/application servers 的默认端口。于是先干掉这个端口。

$ netstat -na|grep 8080
tcp6       0      0  *.8080                 *.*                    LISTEN     
tcp4       0      0  *.8080                 *.*                    LISTEN  
$ lsof -i:8080
COMMAND    PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
launchd    274   u2    9u  IPv4 0x4c7c1dc47078aa3d      0t0  TCP *:http-alt (LISTEN)
launchd    274   u2   10u  IPv6 0x4c7c1dc46f0555f5      0t0  TCP *:http-alt (LISTEN)
printerAg 2052   u2    5u  IPv4 0x4c7c1dc47078aa3d      0t0  TCP *:http-alt (LISTEN)
printerAg 2052   u2    6u  IPv6 0x4c7c1dc46f0555f5      0t0  TCP *:http-alt (LISTEN)

kill -9 401
kill之后会自动重启一个新的进程,8080端口依然健在,汗一个!


$ lsof -i:8080
COMMAND    PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
launchd    274   u2    9u  IPv4 0x4c7c1dc47078aa3d      0t0  TCP *:http-alt (LISTEN)
launchd    274   u2   10u  IPv6 0x4c7c1dc46f0555f5      0t0  TCP *:http-alt (LISTEN)
printerAg 2052   u2    5u  IPv4 0x4c7c1dc47078aa3d      0t0  TCP *:http-alt (LISTEN)
printerAg 2052   u2    6u  IPv6 0x4c7c1dc46f0555f5      0t0  TCP *:http-alt (LISTEN)

难道要妥协? 修改tomcat默认端口从8080到其他端口(8081),太没面子了。

$ cat ~/Library/LaunchAgents/com.hp.printerAgent.plist 




	Label
	com.hp.printerAgent
	OnDemand
	
	Program
	/Library/Printers/hp/laserjet/P1100_1560_1600Series/printerAgent
	ProgramArguments
	
		/Library/Printers/hp/laserjet/P1100_1560_1600Series/printerAgent
	
	RunAtLoad
	
	ServiceIPC
	
	Sockets
	
		MyListenerSocket
		
			SockServiceName
			8080
		
	



或者
sudo sed -i “” -e “s|8080|18089|g” ~/Library/LaunchAgents/com.hp.printerAgent.plist

重启mac,下面就是见证奇迹的时刻~,enjoy it 🙂

本文固定链接: https://www.2hei.net/2013/12/10/mac-change-hp-printer-port-8080/ | 2hei.net

该日志由 u2 于2013年12月10日发表在 others 分类下,
原创文章转载请注明: MAC下修改被HP打印机占用的8080端口 | 2hei.net
关键字:

报歉!评论已关闭.