[Seek Help] 关于deepin v20.5开机加载自已定的.desktop文件!
Tofloor
poster avatar
dgmenghuan
deepin
2022-05-30 17:47
Author

郁闷呀,困扰N天了,就是不执行怎么办,各路大神帮忙看看呀,急!!!

在/home/aa/uwsgi.sh和nginx.sh文件,正常用sh文件执行都可以执行,在.config/autostart/建立两个.desktop文件,一个是uwsgi.desktop和nginx.desktop,

内容分别是nginx.desktop

[Desktop Entry]
Type=Application
Exec=sh /home/mochen/nginx.sh

uwsgi.desktop

[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=sh /home/mochen/uwsgi.sh

用chmod 755都加上可执行,但用systemctl reboot后,就是不启动,大家帮我看看,在线等 ,谢谢!

Reply Favorite View the author
All Replies
beavailable
deepin
2022-05-30 17:58
#1

你要启动脚本就不需要用 .desktop 文件了,直接用这两条命令:

mkdir -p ~/.config/autostart-scripts
ln -sf /home/mochen/nginx.sh ~/.config/autostart-scripts

另外,你的脚本里面需要在第一行包含这个:#!/bin/sh并且需要添加可执行权限。

Reply View the author
灵兮之
deepin
2022-05-30 18:31
#2

我也是这么设置的,一个.sh,再用一个.desktop放到autostart里面,重启经常执行不了,偶尔有那么一次两次才执行的

Reply View the author
dgmenghuan
deepin
2022-05-30 18:56
#3

大神们呀,不好使呀,为什么启动不加载呢??郁闷呀

Reply View the author
新手小白
deepin
2022-05-30 19:57
#4
It has been deleted!
deepinuser17
deepin
2022-05-30 20:56
#5

你这两个文件的格式都不是systemd服务启动的格式。 而且systemd的服务启动文件要放在/etc/systemd/system里面。

autostart-script 的destkop文件时在用户登录时才会运行的。 如果想要再次自动运行,必须退出账户,重新登录。

systemd的服务启动文件可以设置成开机以后自动运行,与用户登录与否没有关系。即不需要用户登录来促使程序运行。

不知道你是要哪种方法。

Reply View the author
deepinuser17
deepin
2022-05-30 21:11
#6

关于创建systemd 服务文件,参考这个链接:

https://bbs.deepin.org/post/237875?id=237875&limit=20&offset=0&postId=1337595

Reply View the author
deepinuser17
deepin
2022-05-30 21:39
#7

https://bbs.deepin.org/post/237865

Reply View the author