重新加载配置文件
systemctl daemon-reload
启动
systemctl start redis
开机启动
systemctl enable redis
取消开机启动
systemctl disable redis
安装reids
进入/etc/systemd/system/
创建
[Unit]
Description=Redis
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/var/run/redis_5372.pid
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
或者
[Unit]
Description=holdorder
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/opt/jdk1.7.0_75/bin/java -jar /opt/holdorder/holdorder-1.5.4.RELEASE.jar
ExecStop=/bin/kill -15 $MAINPID
User=root
Group=root
[Install]
WantedBy=multi-user.target
systemctl list-units ##列出当前系统服务的状态
systemctl list-unit-files ##列出服务的开机状态
systemctl status sshd ##查看指定服务的状态
systemctl stop sshd ##关闭指定服务
systemctl start sshd ##开启指定服务
systemctl restart sshd ##从新启动服务
systemctl enable sshd ##设定指定服务开机开启
systemctl disable sshd ##设定指定服务开机关闭
systemctl reload sshd ##使指定服务从新加载配置
systemctl list-dependencies sshd ##查看指定服务的倚赖关系
systemctl mask sshd ##冻结指定服务
systemctl unmask sshd ##启用服务
systemctl set-default multi-user.target ##开机不开启图形
systemctl set-default graphical.target ##开机启动图形