本文将为大家详细介绍“Linux系统如何设置开机默认启动应用程序”,内容步骤清晰详细,细节处理妥当,而小编每天都会更新不同的知识点,希望这篇“Linux系统如何设置开机默认启动应用程序”能够给你意想不到的收获,请大家跟着小编的思路慢慢深入,具体内容如下,一起去收获新知识吧。
要设置如下程序helloworld,开机运行
[root@buildroot /usr/bin]#ls hello*
helloworld
[root@buildroot /usr/bin]#./helloworld
hello world
1、进入目录
[root@buildroot /usr/bin]#cd /etc/init.d/
[root@buildroot /etc/init.d]#ls
S01syslogd S40network rcS
S02klogd X10modules rndis_host.modules
S02sysctl X10userstart
S20urandom rcK
2、新建 S10userstart,注意大写’S’开头的文件,才会被rcS调用并执行!具体查看rcS文件
[root@buildroot /etc/init.d]#vi S10userstart
输入一下内容:
#!/bin/sh
cd /usr/bin
./helloworld
并设置权限
[root@buildroot /etc/init.d]#chmod 755 S10userstart
4、重启 reboot
[ 2.679812] Indeed it is in host mode hprt0 = 00021501
[ 2.748842] Waiting for root device /dev/mmcblk0p2...
[ 2.792118] mmc0: host does not support reading read-only switch, assuming write-enable
[ 2.806031] mmc0: new high speed SD card at address 0001
[ 2.817006] mmcblk0: mmc0:0001 00000 1.89 GiB
[ 2.827584] mmcblk0: p1 p2
[ 2.866001] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 2.880956] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[ 2.892435] devtmpfs: mounted
[ 2.904567] Freeing unused kernel memory: 452K
[ 2.912637] This architecture does not have kernel memory protection.
[ 2.922701] Run /sbin/init as init process
[ 2.930436] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 2.941495] Indeed it is in host mode hprt0 = 00001101
[ 3.135289] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
hello world
Initializing random number generator: OK
Saving random seed: [ 3.630197] random: dd: uninitialized urandom read (512 bytes read)
OK
Starting network: [ 4.020021] NET: Registered protocol family 10
[ 4.031051] Segment Routing with IPv6
ip: SIOCGIFINDEX: No such device
FAIL
Welcome to Buildroot for eric
buildroot login: [ 5.597955] random: crng init done
root
Password:
[root@buildroot ~]#
[root@buildroot ~]#
可以看到 helloworld 已经运行了!
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
hello world
Linux是一种免费使用和自由传播的类UNIX操作系统,是一个基于POSIX的多用户、多任务、支持多线程和多CPU的操作系统,使用Linux能运行主要的Unix工具软件、应用程序和网络协议。
感谢您能读到这里,小编希望您对“Linux系统如何设置开机默认启动应用程序”这一关键问题有了从实践层面最深刻的体会,具体使用情况还需要大家自己动手实践使用过才能领会,如果想阅读更多相关内容的文章,欢迎关注亿速云行业资讯频道!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。