在Ubuntu中启动时运行Shell脚本 [英] Run a shell script on boot in ubuntu

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

问题描述

我已经完成了一个在热敏打印上的外壳:欢迎戴维德,祝你有个美好的一天".我希望这个脚本在启动时启动.我尝试将它放到任何地方,但一无所获.我放的文件夹是:rc6.d和rc0.d.然后我将整个脚本写在rc.local中,但是什么也没发生.

I've done a shell that print on therminal: "Welcome Davide, have a nice day". This script i want that start on boot. I've tryed to put it everywhere but nothing . The folders i put it are: rc6.d and rc0.d. Then i wrote the whole script in rc.local but nothing happen..

推荐答案

可能您希望它在登录时运行.放在.bashrc

Probably you want it to run at the time of login. Put it in .bashrc

如果您想在登录tty0-tty6之前看到它,请在/etc/issue中输入文字"Welcome Davide,祝你有美好的一天".

If you want to see it before login to tty0-tty6, put the text "Welcome Davide, have a nice day" in /etc/issue.

[fedorqui的分配]:如果希望在登录后在tty0-6上显示它,请将其放在/etc/motd中.从ssh运行时,这不会显示.

[Adition by fedorqui]: If you want it to be displayed on tty0-6 AFTER login, put it in /etc/motd. This will not show up when running from ssh.

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

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