ubuntu设置GUI程序开机启动
2017-12-01 12:09
549 查看
ubuntu 开机启动 自己的GUI程序
我的是ubuntu 16.04 LTS1 、在 /etc/rc.local
中替换成如下代码
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. echo "++++++++start /etc/rc.local++++++" echo "this run GUI application need x-server and kill x-client( /etc/init.d/lightdm ) use your GUI application instead lightdm service" echo "system start order : 1 init 2 login 3 bash 4 startx 5 xinit 6 x-server 7 x-client" echo "x-client is your GUI application" echo "+++++ WangMingXing note this ++++++++++++++++++++++++++++" echo "+++++service --status-all |grep lightdm+++++" service --status-all |grep lightdm echo "+++++ stop service lightdm+++++" /etc/init.d/lightdm stop echo "+++++service --status-all |grep lightdm+++++" service --status-all |grep lightdm echo "+++++ start my x-client+++++" startx /myWorkSpace/app/myGUIApp --usr/bin/Xorg:0 exit 0
修改成自己的GUI程序,只需要替换 倒数第二行
startx /myWorkSpace/app/myGUIApp --usr/bin/Xorg:0
把
/myWorkSpace/app/myGUIApp替换成自己的GUI程序的绝对路径
2、赋予执行权限
chmod 777 /etc/rc.local
然后重启就可以看到自己的GUI程序了
注意事项:
1 可以先在ubuntu机器上安装telnet服务安装openbsd-inetd sudo apt-get install openbsd-inetd 安装telnetd sudo apt-get install telnetd 重启openbsd-inetd sudo /etc/init.d/openbsd-inetd restart 查看telnet运行状态 sudo netstat -a | grep telnet 登录 telnet IP address
然后可以使用 MobaXterm 建立telnet链接 ubuntu主机,查看或控制
MobaXterm 百度网盘 链接: https://pan.baidu.com/s/1pLJZooj 密码: bkj5
2 可以注释掉 rc.local 中
/etc/init.d/lightdm stop这样就是这启动x-server iPublicManager 作为x-client,并且启动x-server lightdm 作为x-client样
linux 使用 Ctrl + Alt + (F1 ~ F7) ,风别切换 tty1 - tty7,
其中 tty1 启动iPublicManager,tty7是默认ubuntu界面
3 系统故障无法启动修复:
1 使用启动U盘系统挂在原系统硬盘,访问并修复原系统
2 在原系统安装远程登录服务,作为虚拟终端访问
4 脚本无法启动修复:
1 赋予执行权限 sudo chmod 777 /etc/rc.local
2 若1步骤后仍然未能执行,是bash 与 sh 命令的区别,
修改脚本头 把 #!/bin/sh -e 改为 #!/bin/bash
相关文章推荐
- Ubuntu 16.04设置rc.local开机启动命令/脚本的方法(通过update-rc.d管理Ubuntu开机启动程序/服务)
- Linux(Ubuntu)下设置开机启动shell脚本执行Java程序jar包
- ubuntu设置程序开机启动
- Ubuntu添加和设置开机自动启动程序的方法
- Ubuntu 设置程序开机启动(以指定用户身份)
- ubuntu 自添加开机启动程序(一种使ethtool设置永久保存在网络设备中的曲线救国方法) 转自:http://www.groad.net/bbs/read.php?tid-1393.html
- ubuntu 12.04 如何设置和优化开机启动的程序
- ubuntu设置自定义程序开机启动(本文以tomcat为例)
- 阿里云ubuntu下设置程序开机自动启动chkconfig
- ubuntu开机自动启动程序设置
- ubuntu设置自定义程序开机启动(本文以tomcat为例)
- Ubuntu添加和设置开机自动启动程序的方法
- ubuntu设置开机启动程序
- Ubuntu 程序开机启动设置
- Ubuntu设置开机启动程序
- ubuntu16.04 程序开机自启动设置及启动优化
- Ubuntu使用之输入法开机启动设置
- 利用注册表 将程序设置为开机启动项目
- ubuntu开机启动特定程序