在 startx 后自动运行脚本 [英] Running a script after startx automatically

查看:25
本文介绍了在 startx 后自动运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用我的树莓派,我设法自动登录 pi 用户,然后自动启动 tomcat,然后也启动 X 服务器.

With my Raspberry Pi, I managed to login pi user automatically, then start tomcat automatically and then start X server as well.

有兴趣的朋友,自动登录:

For those interested, auto login:

1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

代替

1:2345:respawn:/sbin/getty 115200 tty1

在/etc/inittab 中

in /etc/inittab

sh /home/pi/apache-tomcat-7.0.47/bin/startup.sh
su -l pi -c startx
exit 0

在/etc/rc.local

in /etc/rc.local

现在,我想在服务器 X 启动后自动启动我制作的 java 程序(jar 文件).我怎么能这样做?

Now, I'd like to launch a java program (jar file) that I made, automatically after server X has started. How could I do that?

谢谢

更新:在我的 Rapsberry 上,由于使用了 LXDE,http://wiki.lxde.org/en/Autostart 解决了我的问题.

UPDATE: On my Rapsberry, as LXDE is used, http://wiki.lxde.org/en/Autostart solved my problem.

推荐答案

startx 在 X 启动时使用 ~HOME/.xinitrc 文件加载程序其中 ~HOME 是运行 X [ 在本例中为 pi]

startx uses the ~HOME/.xinitrc file to load programs at the startup of X where ~HOME is the home directory of the user running X [ in this case pi]

参见 http://www.x.org/archive/X11R6.8.1/doc/startx.1.html .xinitrc 的例子

see http://www.x.org/archive/X11R6.8.1/doc/startx.1.html for an example of .xinitrc

这篇关于在 startx 后自动运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆