beavailable
deepin
2022-05-30 17:58 你要启动脚本就不需要用 .desktop 文件了,直接用这两条命令:
mkdir -p ~/.config/autostart-scripts
ln -sf /home/mochen/nginx.sh ~/.config/autostart-scripts
另外,你的脚本里面需要在第一行包含这个:#!/bin/sh并且需要添加可执行权限。
Reply Like 0 View the author
你要启动脚本就不需要用 .desktop 文件了,直接用这两条命令:
mkdir -p ~/.config/autostart-scripts
ln -sf /home/mochen/nginx.sh ~/.config/autostart-scripts
另外,你的脚本里面需要在第一行包含这个:#!/bin/sh并且需要添加可执行权限。
我也是这么设置的,一个.sh,再用一个.desktop放到autostart里面,重启经常执行不了,偶尔有那么一次两次才执行的
大神们呀,不好使呀,为什么启动不加载呢??郁闷呀
你这两个文件的格式都不是systemd服务启动的格式。 而且systemd的服务启动文件要放在/etc/systemd/system里面。
autostart-script 的destkop文件时在用户登录时才会运行的。 如果想要再次自动运行,必须退出账户,重新登录。
systemd的服务启动文件可以设置成开机以后自动运行,与用户登录与否没有关系。即不需要用户登录来促使程序运行。
不知道你是要哪种方法。
关于创建systemd 服务文件,参考这个链接:
https://bbs.deepin.org/post/237875?id=237875&limit=20&offset=0&postId=1337595
https://bbs.deepin.org/post/237865
Popular Ranking
ChangePopular Events
More
郁闷呀,困扰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后,就是不启动,大家帮我看看,在线等 ,谢谢!