fedora 17上已经找不到/etc/rc.local了,如果我们想开机执行某个脚本,就需要手动创建这个文件,目录也发生了小小变化:
1. 新建文件/etc/rc.d/rc.local,第一行须指明执行shell:
[root@tp rc.d]# cat rc.local
#!/bin/bash
chmod a+rw /dev/vmnet*
2. 加上执行权限:
[root@tp rc.d]# chmod +x rc.local
[root@tp rc.d]# ll rc.local
-rwxr-xr-x. 1 root root 35 6月 9 14:23 rc.local
3. 使用systemctl进行调用测试:
[root@tp rc.d]# ll /dev/vmnet*
crwx------. 1 root root 119, 0 6月 9 13:39 /dev/vmnet0
crwx------. 1 root root 119, 1 6月 9 13:39 /dev/vmnet1
crwx------. 1 root root 119, 2 6月 9 13:39 /dev/vmnet2
crwx------. 1 root root 119, 8 6月 9 13:39 /dev/vmnet8
[root@tp rc.d]# systemctl restart rc-local.service
[root@tp rc.d]# ll /dev/vmnet*
crwxrw-rw-. 1 root root 119, 0 6月 9 13:39 /dev/vmnet0
crwxrw-rw-. 1 root root 119, 1 6月 9 13:39 /dev/vmnet1
crwxrw-rw-. 1 root root 119, 2 6月 9 13:39 /dev/vmnet2
crwxrw-rw-. 1 root root 119, 8 6月 9 13:39 /dev/vmnet8
[root@tp rc.d]#
4. 重启后rc.local即会被自动调用。
REF:
1. Making rc-local.service work
http://skorzen.blogspot.com/2012/04/making-rc-localservice-work.html
https://wiki.archlinux.org/index.php/Systemd_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29