默认终端自启动程序如何隐藏终端不显示

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
头像
widon1104
帖子: 839
注册时间: 2008-07-17 10:55

默认终端自启动程序如何隐藏终端不显示

#1

帖子 widon1104 » 2015-10-15 23:34

我有一个用expect程序执行的脚本需要开机时候就运行
widon@widon-X401A:~$ cat ~/.config/autostart/囗囗囗.sh.desktop
[Desktop Entry]
Type=Application
Exec=/usr/bin/expect /home/widon/.bin/囗囗囗.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[zh_CN]=囗囗囗
Name=囗囗囗
Comment[zh_CN]=
Comment=
Terminal=true
我发现我必须把Terminal=true加上,程序才能启动成功,,但是这时候桌面会启动一个terminal程序
我想让程序自启动,但是不启动terminal程序,如何做?
附件
1.png
头像
widon1104
帖子: 839
注册时间: 2008-07-17 10:55

Re: 默认终端自启动程序如何隐藏终端不显示

#2

帖子 widon1104 » 2015-10-18 8:56

退而求其次,可否让这个terminal在工作区2启动啊?
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 默认终端自启动程序如何隐藏终端不显示

#3

帖子 poloshiao » 2015-10-18 9:23

在 15.04 ?
头像
widon1104
帖子: 839
注册时间: 2008-07-17 10:55

Re: 默认终端自启动程序如何隐藏终端不显示

#4

帖子 widon1104 » 2015-10-18 11:37

poloshiao 写了:在 15.04 ?
我用的是ubuntu mate 15.04,但是桌面是gnome3
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 默认终端自启动程序如何隐藏终端不显示

#5

帖子 poloshiao » 2015-10-18 15:06

我用的是ubuntu mate 15.04,但是桌面是gnome3
init 初始化 是使用預設的 systemd 還是有切換成 Upstart ?
因為給你的建議可能不同
头像
widon1104
帖子: 839
注册时间: 2008-07-17 10:55

Re: 默认终端自启动程序如何隐藏终端不显示

#6

帖子 widon1104 » 2015-10-18 17:23

widon@widon-X401A:~$ ls /usr/share/upstart/
sessions xdg
widon@widon-X401A:~$ ls /usr/lib/systemd/
catalog network ntp-units.d user user-generators
widon@widon-X401A:~$ ps ax | grep Upstart -i
1224 ? Ss 0:00 /sbin/upstart --user
1290 ? S 0:00 upstart-udev-bridge --daemon --user
1371 ? S 0:00 upstart-dbus-bridge --daemon --system --user --bus-name system
1378 ? S 0:13 upstart-dbus-bridge --daemon --session --user --bus-name session
1412 ? S 0:00 upstart-file-bridge --daemon --user
16320 pts/4 S+ 0:00 grep --color=auto Upstart -i
widon@widon-X401A:~$ ps ax | grep systemd
244 ? Ss 0:01 /lib/systemd/systemd-journald
263 ? Ss 0:00 /lib/systemd/systemd-udevd
681 ? Ss 0:00 /lib/systemd/systemd-logind
686 ? Ss 0:00 /sbin/cgmanager -m name=systemd
735 ? Ss 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
1212 ? Ss 0:00 /lib/systemd/systemd --user
16340 pts/4 S+ 0:00 grep --color=auto systemd


怎么判断啊?好像2个都在用
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 默认终端自启动程序如何隐藏终端不显示

#7

帖子 poloshiao » 2015-10-18 17:52

怎么判断啊?
viewtopic.php?p=3131692#p3131692
好像2个都在用
避免混用
但是可以從開機選單輕易切換
15.04 開機選單 預設是 Systemd
但是 可以從開機選單選擇 Upstart
头像
widon1104
帖子: 839
注册时间: 2008-07-17 10:55

Re: 默认终端自启动程序如何隐藏终端不显示

#8

帖子 widon1104 » 2015-10-18 23:07

poloshiao 写了:
怎么判断啊?
viewtopic.php?p=3131692#p3131692
好像2个都在用
避免混用
但是可以從開機選單輕易切換
15.04 開機選單 預設是 Systemd
但是 可以從開機選單選擇 Upstart
widon@widon-X401A:~$ pstree
systemd─┬─ModemManager─┬─{gdbus}
│ └─{gmain}
├─NetworkManager─┬─dhclient
│ ├─dnsmasq
│ ├─{NetworkManager}
│ ├─{gdbus}
│ └─{gmain}
├─accounts-daemon─┬─{gdbus}
│ └─{gmain}
├─acpid
├─agetty
├─atd
├─avahi-daemon───avahi-daemon
├─avahi-dnsconfd
├─cgmanager
├─colord─┬─{gdbus}
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 默认终端自启动程序如何隐藏终端不显示

#9

帖子 poloshiao » 2015-10-18 23:53

pstree
systemd─┬─ModemManager─┬─{gdbus}
1. 預設 初始化 systemd
cat ~/.config/autostart/囗囗囗.sh.desktop
2. systemd 自動啟動機制 跟 ~/.config/autostart 無關

2-1. 參閱 (由易漸難)
2-1-1. https://www.computersnyou.com/4695/how- ... ick-guide/
How To Manage Services With SystemD [ Quick Guide ]
2-1-2. http://www.howtogeek.com/216454/how-to- ... ux-system/
How to Manage Systemd Services on a Linux System
2-1-3. https://www.digitalocean.com/community/ ... l-examples
Auto-starting Services with systemd

2-2. 要如何寫 Service file (由易漸難)
2-2-0. http://patrakov.blogspot.tw/2011/01/wri ... files.html
Writing systemd service files
2-2-1. http://0pointer.net/blog/projects/syste ... ins-3.html
How Do I Convert A SysV Init Script Into A systemd Service File?
2-2-2. http://manpages.ubuntu.com/manpages/viv ... ice.5.html
systemd.service - Service unit configuration
2-2-2-1. 參考文章 目錄如果不同 以這一篇 Ubuntu 15.04 的 manpage 為準
2-2-3. http://www.freedesktop.org/software/sys ... rvice.html
systemd.service — Service unit configuration

3. 先詳細參閱 有疑問 歡迎再貼文

4. sudo systemctl list-units --no-pager | grep terminal
沒有回應
意思是 沒有現成的 gnome-terminal.service
需要自己動手寫
4-1. Ubuntu 15.04 org.gnome.Terminal.service (僅供參考 不是 systemd 的 service file)
sudo cat /usr/share/dbus-1/services/org.gnome.Terminal.service
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 默认终端自启动程序如何隐藏终端不显示

#10

帖子 poloshiao » 2015-10-19 7:39

~/.config/autostart/囗囗囗.sh.desktop
能否在 systemd 啟動 ~/.config/autostart/囗囗囗.sh.desktop ?

1. 可以試試 補釘程式
加 "X-GNOME-Autostart-Delay" key 在 囗囗囗.sh.desktop

1-1. https://launchpad.net/ubuntu/vivid/+sou ... +changelog
- debian/patches/22_support_autostart_delay.patch:
Bugzilla patch to support adding a delay to autostart apps, using
a "X-GNOME-Autostart-Delay" key in the desktop file

1-2. http://ubuntuguide.net/delay-a-start-up ... untu-unity
How to Delay A Start Up Application in Ubuntu Unity

1-3. http://www.webupd8.org/2014/05/how-to-d ... ns-in.html
How To Delay Startup Applications In GNOME / Unity [Quick Tip]

2. 當然 你也可以從開機選單 選擇 Upstart 開機
就跟 Ubuntu 14.10 及 以前 版本 相同
我想让程序自启动,但是不启动terminal程序,如何做?
退而求其次,可否让这个terminal在工作区2启动啊?
3. 等你這個 systemd or upstart 初始化 確定了
再來探討
头像
sunfish
帖子: 989
注册时间: 2008-05-03 1:53

Re: 默认终端自启动程序如何隐藏终端不显示

#11

帖子 sunfish » 2015-10-19 21:08

不要有输出,将脚本里有有输出的命令后加上&>/dev/null,这样应该就不会弹出了
docker && kubernetes
头像
widon1104
帖子: 839
注册时间: 2008-07-17 10:55

Re: 默认终端自启动程序如何隐藏终端不显示

#12

帖子 widon1104 » 2015-10-26 20:37

sunfish 写了:不要有输出,将脚本里有有输出的命令后加上&>/dev/null,这样应该就不会弹出了
没用啊
回复