关于开机脚本的问题!

sh/bash/dash/ksh/zsh等Shell脚本
回复
wfnh
帖子: 84
注册时间: 2008-02-20 11:46
联系:

关于开机脚本的问题!

#1

帖子 wfnh » 2008-06-14 2:43

本人用的是校园网,觉得每次都要打命令“linux1x”才能上网真的很不爽,所以就想写一个脚本,让ub一开机就可以自动拨号,免于打命令的痛苦,在网上看了教程,说是在etc/init.d里建立一个脚本(我的为online,权限已设置为755),然后在rc2.d里建立一个软连接(名为K99online)就可以了,但我是了很多次都不行,望求各位帮帮忙!
online内容如下:
____________
#!/bin/bash
each
linux1x
each
________
头像
ebok
帖子: 852
注册时间: 2008-02-15 0:09

#2

帖子 ebok » 2008-06-14 3:02

把命令linux1x加进/etc/rc.local试试.比写脚本简单.
Somebody think they are full of niubility, so they play a zhuangbility, but only reflect their shability.
wfnh
帖子: 84
注册时间: 2008-02-20 11:46
联系:

#3

帖子 wfnh » 2008-06-14 3:42

好的,我试一下吧1!
但我听说,那样好像不大好的样子喔!!
头像
ebok
帖子: 852
注册时间: 2008-02-15 0:09

#4

帖子 ebok » 2008-06-14 5:11

反正rc.local也是要在rc2.d里最后一个启动的.本身也是一个脚本的连接文件.
Somebody think they are full of niubility, so they play a zhuangbility, but only reflect their shability.
igotcha
帖子: 190
注册时间: 2007-02-27 0:43

#5

帖子 igotcha » 2008-06-19 13:36

随便写个脚本,加在会话里不行吗????
azhwhy
帖子: 60
注册时间: 2007-11-06 11:21

#6

帖子 azhwhy » 2008-06-19 15:07

niubility? zhuangbility? shability?
哈哈,ebok的签名笑死我了,原来英文还可以这么用,哈哈
armot
帖子: 5
注册时间: 2008-06-23 8:51

sdfsf

#7

帖子 armot » 2008-06-23 17:15

afdsafsafddafddddddafs
lorenxu
帖子: 49
注册时间: 2007-10-29 12:04

#8

帖子 lorenxu » 2008-06-23 17:22

我的情况类似,高手加油!
头像
hualang0929
帖子: 1226
注册时间: 2006-11-11 10:23
来自: Mars
联系:

#9

帖子 hualang0929 » 2008-06-23 19:30

放到 rc.local
抬头望星空一片晴,我独行,夜已渐寒……
头像
tenfar
帖子: 336
注册时间: 2005-12-10 17:36
来自: 北京市海淀区上地十街辉煌国际
联系:

#10

帖子 tenfar » 2008-06-27 21:29

晕,我给你们上传一个吧是python脚本,我是直接放到rc.d的。当然我用的系统是arch,脚本不是我写的,我网上找到的。

代码: 全选

#!/usr/bin/env python
#coding=utf-8
import os,time
# 重连次数限制
maxrelink = 200
query = 'ps aux | grep "linux1x" | grep -v "grep" | wc -l'
# link 为执行您的linux1x脚本的shell命令
link = 'sudo linux1x -u username/password -n eth0 -d'
if __name__ == '__main__':
    cnt = 0
    while cnt < maxrelink:
        c,r = os.popen2(query)
        c.close()
        if int(r.read()) == 0:
            # 重连
            os.system(link)
        time.sleep(60)
Laptop:HP Compaq Presario V3210AU
OS:Gentoo openbox+stalonetray+rox-filer+gmrun+mplayer+firefox+ibus+sonata+tilda
Phone:Orange Dopod 838+ SPV C600
OS:Windows Mobile 6.1
delectate
帖子: 18311
注册时间: 2008-01-09 22:41

#11

帖子 delectate » 2008-06-27 22:17

igotcha 写了:随便写个脚本,加在会话里不行吗????
直接加到会话就好了

不用写脚本了吧

貌似可以加入命令的
回复