To move some servers to a different cabinet and not know which services to restart after rebooting, you can save the service status and path and execute commands in the following ways 1, psps f -eo pid,tty,stat,time,command > ${hostname}_$ (date +%y%m%d) _PS2, netstatnetstat -tupnl > ${hostname}_$ (date +%y%m%d) _NETSTAT3, cmdlinecat /proc/2644/cmdline/usr/bin/redis-server /etc/redis/redis.conf/ proc/$pid/cwd4, cwdll /proc/2644/cwdlrwxrwxrwx 1 redis redis 0 2015-05-12 14:05 /proc/2644/cwd -> /var/lib/redis/proc/pid/Directory and file description (section) 1, cmdline the command executed when the process was started ( Contains run-time parameter information) 2, cmd links to the current working directory of the process 3, the Environ process executes the environment variable 4, the FD contains the process-related file descriptor 5, limits the file stores the process soft limit, hard limit and other information. 6, maps and process-related memory mapping information address perms offset dev inode pathname7fc234be2000-7fc234bee000 r-xp 00000000 08:01 1198370 /lib/libnss _FILES-2.11.3.SO1) Address: Process occupancy's address space. 2) perms: Permission set r = readw = writex = executes = sharedp = private (copy on write) 3) Offset: file offset. 4) Dev: for Device (Major:minor) 5) Inode: Inode on device. 0 is an inter-memory area that has no inode associated, typically: BSS (uninitialized data) 7, exe links to the basic state of the execution command file 8, status (STAT STATM) process of the process
This article is from the "7928217" blog, please be sure to keep this source http://7938217.blog.51cto.com/7928217/1650601
PS netstat pid to save service status