Fik*_*dal 5 startup bash .desktop
当我手动启动它时,这个脚本工作得很好。我怎样才能让它在启动时运行?该脚本的功能是Docky在发生崩溃时自动重新启动。
我创建了这样的脚本:
gedit ~/process_monitor.sh粘贴在以下内容中(在 Ask Ubuntu 上找到):
#!/bin/bash
if [[ -z "$1" ]];then
echo "ERROR: must specify program"
exit 1
fi
while (( 0 == 0 ));do
$@ &
pid=`jobs -l | awk '{print $2}'`
wait $pid
done
Run Code Online (Sandbox Code Playgroud)
保存了文件。
设置权限:
chmod a+x ~/process_monitor.sh
Run Code Online (Sandbox Code Playgroud)现在,当我像这样运行它时,它可以完美运行:
~/process_monitor.sh docky
Run Code Online (Sandbox Code Playgroud)
但是,当我将以下内容添加到启动应用程序时,不会使脚本在启动时启动。好吧,也许可以,但脚本不起作用。
/bin/bash ~/process_monitor.sh docky
基本上有某种图形元素会在屏幕上闪烁半秒钟,但没有其他脚本迹象可以看到,并且Docky如果它被杀死也不会重新启动。
如何使这项工作?我确定这是非常基本的。
我在 Ubuntu 14.04 上。
Jac*_*ijm 10
问题是启动应用程序.desktop在~/.config/autostart
在.desktop文件中,您不能使用相对路径或变量路径,例如~. 改用绝对路径:
/bin/bash /absolute/path/to/process_monitor.sh docky
Run Code Online (Sandbox Code Playgroud)