# keepalived_scripts **Repository Path**: zhao-dong/keepalived_scripts ## Basic Information - **Project Name**: keepalived_scripts - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-08-14 - **Last Updated**: 2024-10-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README https://blog.csdn.net/yanhanhui1/article/details/117196904 TestService-0.0.1-SNAPSHOT.jar service port is 7777 http://192.168.29.129:7777/test java -jar -Dserver.port=8081 /opt/ncc/TestService-0.0.1-SNAPSHOT.jar Spring-boot启动添加参数 https://zhuanlan.zhihu.com/p/146053387 Spring Boot 项目脚本(启动、停止、重启、状态) https://zhuanlan.zhihu.com/p/147876556 shell命令行&&、||和 ; 的使用方法 https://blog.csdn.net/u011630575/article/details/97613695 # TODO - **Type**   服务的类型,常用的有 simple(默认类型) 和 forking。默认的 simple 类型可以适应于绝大多数的场景,因此一般可以忽略这个参数的配置。而如果服务程序启动后会通过 fork 系统调用创建子进程,然后关闭应用程序本身进程的情况,则应该将 Type 的值设置为 forking,否则 systemd 将不会跟踪子进程的行为,而认为服务已经退出。 - **PIDFile**   守护进程的PID文件,必须是绝对路径。 强烈建议在 `Type=``forking` 的情况下明确设置此选项。 systemd 将会在此服务启动后从此文件中读取主守护进程的PID 。 systemd 不会写入此文件, 但会在此服务停止后删除它(若存在)。 PIDFile的作用是什么??? - `Type=forking` 用于进行 fork 系统调用的守护进程。该服务的主要进程使用 *path_to_pidfile* 中指定的 PID 创建。在 [重要 [Service\] 部分选项](https://docs.redhat.com/zh_hans/documentation/red_hat_enterprise_linux/8/html-single/using_systemd_unit_files_to_customize_and_optimize_your_system/index#tabl-systemd-Service_Sec_Options)中查找其他启动类型。 ``` PIDFile= ``` Takes a path referring to the PID file of the service. Usage of this option is recommended for services where `Type=` is set to `forking`. The path specified typically points to a file below `/run/`. If a relative path is specified it is hence prefixed with `/run/`. The service manager will read the PID of the main process of the service from this file after start-up of the service. The service manager will not write to the file configured here, although it will remove the file after the service has shut down if it still exists. The PID file does not need to be owned by a privileged user, but if it is owned by an unprivileged user additional safety restrictions are enforced: the file may not be a symlink to a file owned by a different user (neither directly nor indirectly), and the PID file must refer to a process already belonging to the service. Note that PID files should be avoided in modern projects. Use `Type=notify`, `Type=notify-reload` or `Type=simple` where possible, which does not require use of PID files to determine the main process of a service and avoids needless forking. https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/using_systemd_unit_files_to_customize_and_optimize_your_system/assembly_working-with-systemd-unit-files_working-with-systemd#proc_creating-a-custom-unit-file-by-using-the-second-instance-of-the-sshd-service_assembly_working-with-systemd-unit-files [linux - What is systemd PID file? - Stack Overflow](https://stackoverflow.com/questions/47826123/what-is-systemd-pid-file/67724450#67724450) https://stackoverflow.com/questions/47826123/what-is-systemd-pid-file/67724450#67724450 The idea is that many existing services do a `fork()` and you have no control over whether the service should or not fork. So in that case you want to use this option.