启动命令: 
 nohup /usr/bin/beanstalkd -l 0.0.0.0  -p 11300 & >> /dev/null 2>&1
正常启动后,利用 【lsof -i:11300】查看 该服务是否正常启动
停止命令:
 /etc/init.d/beanstalkd stop
 正常停止后,利用 【lsof -i:11300】查看 该服务是否正常停止
【使用&后台运行程序】:
结果会输出到终端
使用Ctrl + C发送SIGINT信号,程序免疫
关闭session发送SIGHUP信号,程序关闭
【使用nohup运行程序】:
 结果默认会输出到nohup.out
使用Ctrl + C发送SIGINT信号,程序关闭
关闭session发送SIGHUP信号,程序免疫
【日后使用】
 经常使用 nohup 和 & 配合来启动程序,如: nohup ./test &
同时免疫SIGINT和SIGHUP信号
  
lsof 命令常用于查找进程打开了哪些文件以及与打开文件相关联的内容,这篇文章将介绍 lsof 常用的命令参数,下面通过实例进行说明。
一、基本概念
     命令 lsof ( list opened files )负责列出系统中已经打开的文件,包括普通文件,目录,块特殊文件,字符特殊文件,正在执行的文本引用,库,流或网络文件(例如:网络套接字,NFS文件或UNIX域套接字)。
二、常用参数
 -p pid : 输出指定进程打开的文件;
-l : 输出中使用ID代替用户名;
-u userName : 输出指定用户打开的文件;
-c string : 输出 COMMAND 列中包含 string 的项;
-d fd : 输出包含指定描述符的项;
fileName : 输出打开文件 fileName 的所有项;
-i [46] [protocol][@hostname|hostaddr][:service|port] : 输出符合指定条件的项,其中:
46 :分别指 IPv4、IPv6;
protocol :指 TCP 或 UDP;
hostname : 网络主机名;
hostaddr : IP 地址;
service : 包含在 /etc/services 中的名称;
    port : 端口号,可以是多个;
  
执行命令 lsof -c sshd,输出 COMMAND 列包含 sshd 的项,如下所示:
[root@localhost ~]# lsof -c sshd
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfsOutput information may be incomplete.
COMMAND   PID       USER   FD   TYPE             DEVICE SIZE/OFF      NODE NAME
sshd     9237       root  cwd    DIR              253,0      236        64 /
sshd     9237       root  rtd    DIR              253,0      236        64 /
sshd     9237       root  txt    REG              253,0   853040  35966750 /usr/sbin/sshd
sshd     9237       root  mem    REG              253,0    61560  33617054 /usr/lib64/libnss_files-2.17.so
sshd     9237       root  mem    REG              253,0    68192  33750408 /usr/lib64/libbz2.so.1.0.6
sshd     9237       root  mem    REG              253,0   100008  33750485 /usr/lib64/libelf-0.172.so
sshd     9237       root  mem    REG              253,0    19896  33750102 /usr/lib64/libattr.so.1.1.0
sshd     9237       root  mem    REG              253,0    15688  33750299 /usr/lib64/libkeyutils.so.1.5
sshd     9237       root  mem    REG              253,0    62888  33750374 /usr/lib64/libkrb5support.so.0.1