[Others] 如何让服务程序在系统服务启动完成后,延迟启动?
Tofloor
poster avatar
wang3develop
deepin
2023-04-04 22:52
Author

window系统中,可以将服务注册为系统服务,并延迟启动。

我现在系统换到deepin系统了,每次启动系统后,都得使用命令启动一下数据库PostgreSQL(后面可能还有其他服务)。

deepin系统中,普通级别的帐号登录后,如何像window一样自延迟启动其他服务呢?

Reply Favorite View the author
All Replies
神末shenmo
deepin
Spark-App
Q&A Team
2023-04-04 23:08
#1

/etc/xdg/autostart

Reply View the author
W2J
deepin
2023-04-04 23:39
#2

2023-04-04-systemd-unit.png

Reply View the author
W2J
deepin
2023-04-04 23:39
#3

2023-04-04-systemd-unit-type.png

Reply View the author
W2J
deepin
2023-04-04 23:42
#4

如今,systemd一统江湖。

按照systemd方式来,不会过时。

Reply View the author
W2J
deepin
2023-04-04 23:43
#5

systemd管理linux的runtime依赖关系

Reply View the author
W2J
deepin
2023-04-04 23:48
#6

systemd取代了过去对shell脚本的依赖,采取独立方式实现方式,对依赖关系进行运行时管理。

Reply View the author
W2J
deepin
2023-04-04 23:52
#7

systemd也是linux系统的1号进程。

Reply View the author
W2J
deepin
2023-04-05 00:05
#8

在系统管理中,1号进程是deamon和service的父进程(控制者)。

在用户session管理中,用户终端是用户app的进程的控制台。

Reply View the author
DebuggerX
deepin
2023-04-05 00:32
#9
神末shenmo

/etc/xdg/autostart

正解。

对当前用户来说写到 ~/.config/autostart/ 下更好

Reply View the author
wang3develop
deepin
2023-04-05 01:16
#10

感谢各位!

开始编写了一个~/.config/autostart/pgsql.desktop,系统启动后,postgresql并没有启动

[Desktop Entry]
Name=postgresql
Type=Application
Exec=????
Terminal=true

后面修改使用绝对路径后(暂不清楚是绝对路径还是环境变量的问题),成功自启!

Reply View the author
Ziggy
deepin
2023-04-05 05:58
#11

可以写个service,具体指定在某service后启动

Reply View the author
忘记、过去
deepin
2023-04-05 06:55
#12
wang3develop

感谢各位!

开始编写了一个~/.config/autostart/pgsql.desktop,系统启动后,postgresql并没有启动

[Desktop Entry]
Name=postgresql
Type=Application
Exec=????
Terminal=true

后面修改使用绝对路径后(暂不清楚是绝对路径还是环境变量的问题),成功自启!

Exec= 里面只能用绝对路径

Reply View the author