LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1102|回复: 5

如何让自己写的脚本开机时自动运行

[复制链接]
发表于 2006-5-21 00:55:54 | 显示全部楼层 |阅读模式
自习写的一个小脚本 automount
内容如下:
mount --bind /mnt/ftp2/ftp2/gandankunlun /mnt/ftp1/gandankunlun
mount --bind /mnt/ftp2/ftp2/qita /mnt/ftp1/qita
mount --bind /mnt/ftp2/ftp2/uploadfromforum /mnt/ftp1/uploadfromforum
mount --bind /mnt/ftp2/ftp2/deutschstudy /mnt/ftp1/deutschstudy
mount --bind /mnt/ftp2/ftp2/music /mnt/ftp1/music
mount --bind /mnt/ftp2/ftp2/software /mnt/ftp1/software
mount --bind /mnt/ftp2/ftp2/Veranstaltungsfoto /mnt/ftp1/Veranstaltungsfoto


如何让这个脚本在开机的时候自启动。


我把这个脚本改成
#!/bin/bash

if [ "$1" = "start" ]
then
mount --bind /mnt/ftp2/ftp2/gandankunlun /mnt/ftp1/gandankunlun
mount --bind /mnt/ftp2/ftp2/qita /mnt/ftp1/qita
mount --bind /mnt/ftp2/ftp2/uploadfromforum /mnt/ftp1/uploadfromforum
mount --bind /mnt/ftp2/ftp2/deutschstudy /mnt/ftp1/deutschstudy
mount --bind /mnt/ftp2/ftp2/music /mnt/ftp1/music
mount --bind /mnt/ftp2/ftp2/software /mnt/ftp1/software
mount --bind /mnt/ftp2/ftp2/Veranstaltungsfoto /mnt/ftp1/Veranstaltungsfoto
fi


然后,拷贝到/etc/init.d/automount
接下来,在/etc/rc5.d/中创建链接 S20automount --------->/etc/init.d/automount

重启系统后发现根本没有效果。
不知道错在哪里,还有没有其他的好方法。
发表于 2006-5-21 01:54:55 | 显示全部楼层
写到 /etc/init.d/bootmisc.sh
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-21 17:48:11 | 显示全部楼层
多谢楼上的,问题解决了
回复 支持 反对

使用道具 举报

发表于 2006-5-21 18:17:50 | 显示全部楼层
貌似应该放到/etc/rc2.d/下吧?
debian的默认启动level是2
回复 支持 反对

使用道具 举报

发表于 2006-5-21 19:22:45 | 显示全部楼层
Post by PiPiDou
写到 /etc/init.d/bootmisc.sh

什么意思呢?能不能仔细见解一下,谢谢
回复 支持 反对

使用道具 举报

发表于 2006-5-21 19:24:42 | 显示全部楼层
写启动脚本是不是在/etc/init.d/下加一个脚本,然后在/etc/rc2.d/建立一个链结就好了
还有/etc/rcS,d是什么用的呢?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表