作者: sixth 出处:赛迪网 阅读提示:首先编写了一个用作服务的程序,功能很简单,每隔1秒钟把当前时间写入一个文件中.... void recordTime() { const char pa[256] = "//home//projects//testService//recordTime"; ofstream fout; fout.open(pa, ios::app); time_t currTime; struct tm *tp; char buf[256]; while(1) { currTime = time(NULL); tp = localtime(&currTim...
小弟在自学linux,6月份要参加一个比赛。现在系统管理还没有看完,卡在了shell脚本这里,实在是感觉头疼。 6月份的比赛很多是关于linux下的服务器搭建与维护。 想问下各位高手,linux服务器搭建与维护用到的shell脚本知识多么?如果不多的话,我想先看下linux服务器搭建,突击下6月份的比赛。 感觉shell脚本和linux系统管理还有linux服务器搭建维护是linux的三大块啊! 听听大家的看法吧,先谢谢了
#!/bin/bash#ts4.sh clear [color="#ff0000"]#脚本存放路径 PWD="/root/shell/ts" echo `date` [color="#ff0000"]#ip_list 文件是需要检查的服务器和服务器端口 ls $PWD/ip_list 2> /dev/null if [ $? -eq 0 ] then echo "this is file is ture!" NUM=`wc -l $PWD/ip_list | awk '{print $1}'` while read LINE do echo $LINE >$PWD/temp.ip x=`awk '{printf $1}' $PWD/temp.ip` y=`awk '{printf $2}' $PWD/temp.i...
#!/bin/bash #program:Usingtostudythe[if...then...fi]program #dsk2007/10/83:00 #content:Iwillusingthisprogramtoshowyousevices #1.printtheprogram''sworkinyourscreen echo "Now,the service of your linux system will be detect!" echo "The www,ftp,ssh,and sendmail pop3 will be detect!" echo "" #2.www www=`netstat -ntlp | awk '{print $4}' | grep :80$` if [ "$www" != "" ]; then echo $www echo "WWW is runi...
我有多台linux服务器需要维护,每次我都需要远程连接到每天服务器进行相同的操作,随着服务器数量的增加,感觉越来越麻烦,是否可以做一个shell脚本,我只要在一台服务器上执行这个脚本后加命令,就可以把指令发送到所有的服务器上自动执行,但是也不能做key,请高手解说下该如何做,或者做一个2台服务器的脚本让我参考下。
我的应用服务是 linux9.0+httpd+tomcat+postgres 我如何做一个程序(或脚本)让系统每隔几秒访问数据库和网络情况, 如果有问题,分别通过email和sms通知我。(发短信的程序我有了)。 请各位有经验的朋友帮忙。我会非常感谢。
本帖最后由 chinaboywg 于 2011-03-24 16:10 编辑 [code]#!/bin/bash #by chinaboyxiaobao #####edit_config function vsftpd_conifg() { sed 's/\#write_enable=YES/write_enable=YES/g' /etc/vsftpd.conf >/etc/vsftpd.conf.tmp mv /etc/vsftpd.conf.tmp /etc/vsftpd.conf sed 's/\#local_enable=YES/local_enable=YES/g' /etc/vsftpd.conf >/etc/vsftpd.conf.tmp mv /etc/vsftpd.conf.tmp /etc/vsftpd....
ubuntu下的ssh客户端一直没找到象SecureCRT那样好用的工具。用ssh登录,每次都要输入密码,感觉很麻烦,而且因为字符集不相同,一般还有乱码问题,所以参照网上的一些实现自己也通过python来实现了一下。 #1.通过参数自动登录ssh远程服务器 #2.通过配置字符集解决中文乱码问题 #3.解决改变远程窗口默认较小bug,远程窗口同本地窗口大小动态改变未处理 #4.实现2级代理 #5.可以使用sftp登录来传文件(sftp,目前不能...
#!/bin/bash #program:Usingtostudythe[if...then...fi]program #dsk2007/10/83:00 #content:Iwillusingthisprogramtoshowyousevices #1.printtheprogram''sworkinyourscreen echo "Now,the service of your linux system will be detect!" echo "The www,ftp,ssh,and sendmail pop3 will be detect!" echo "" #2.www www=`netstat -ntlp | awk '{print $4}' | grep :80$` if [ "$www" != "" ]; then echo $www echo "W...
#!/bin/bash#ts4.sh clear [color="#ff0000"]#脚本存放路径PWD="/root/shell/ts" echo `date` [color="#ff0000"]#ip_list 文件是需要检查的服务器和服务器端口ls $PWD/ip_list 2> /dev/null if [ $? -eq 0 ] then echo "this is file is ture!" NUM=`wc -l $PWD/ip_list | awk '{print $1}'` while read LINE do echo $LINE >$PWD/temp.ip x=`awk '{printf $1...