Linux 如何在systemd Ubuntu 18.04上启动时自动执行shell脚本

Linux 如何在systemd Ubuntu 18.04上启动时自动执行shell脚本,linux,systemd,Linux,Systemd,我想在ubuntu 18.04上启动时自动启动安装程序 看 我的壳是shadowsocks.sh #!/bin/bash if [ -f /usr/bin/sslocal ]; then sudo /usr/bin/sslocal -c /etc/shadowsocks/config.json -d restart -v fi 它运行良好 我用systemctl进行了设置 像这样的服务 [Service] ExecStart=/usr/local/bin/shadowsocks.sh

我想在ubuntu 18.04上启动时自动启动安装程序

我的壳是shadowsocks.sh

#!/bin/bash
if [ -f /usr/bin/sslocal ]; then 
   sudo /usr/bin/sslocal -c /etc/shadowsocks/config.json -d restart -v
fi
它运行良好

我用systemctl进行了设置

像这样的服务

[Service]
ExecStart=/usr/local/bin/shadowsocks.sh
[Install]
WantedBy=default.target
Alias=ss.service
当我跑的时候

sudo systemctl start ss.service
我可以看到阴影袜被记录为“开始”

但我看不到shadowsocks的启动,也不能使用google


我是中国人,很抱歉我的英语不好,我希望有人能看到我的问题

delete-d在shell脚本中


一切正常

最简单的方法是通过ubuntu调整工具。只需安装调整工具并通过GUI添加应用程序。范例