linux service

service与chkconfig的替代者systemctl

https://blog.csdn.net/itcomputer12/article/details/41799139

systemctl创建 service

https://blog.csdn.net/gbenson/article/details/51083817

https://blog.csdn.net/qq_14852397/article/details/71794574?locationNum=11&fps=1

https://blog.csdn.net/chwshuang/article/details/68489968

创建Redis服务过程

sudo vi /lib/systemd/system/redis.service

[Unit]
Description=Redis
After=network.target

[Service]
ExecStart=/opt/redis-4.0.9/src/redis-server /opt/redis-4.0.9/redis.conf  --daemonize no
ExecStop=/opt/redis-4.0.9/src/redis-cli -h 127.0.0.1  -p 6379 -a ${password}  shutdown

[Install]
WantedBy=multi-user.target

运行shell

systemctl daemon-reload
systemctl enable redis
systemctl start redis

注:
systemctl enable redis 相当于执行了: ln -s /lib/systemd/system/redis.service /etc/systemd/system/multi-user.target.wants/redis.service

查看开机启动项

http://www.cnblogs.com/end/archive/2012/10/12/2721059.html

sudo apt-get install sysv-rc-conf
sysv-rc-conf

systemctl list-unit-files

列出所有状态 : service --status-all

启动sshd服务

service sshd start

设置sshd服务开机启动

chkconfig sshd start

posted @   NewSea  阅读(187)  评论(0编辑  收藏  举报
编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端
历史上的今天:
2012-04-17 Js 定义对象的方法
2012-04-17 试用 CouchBase。
点击右上角即可分享
微信分享提示