/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行并从/etc/profile.d目录的配置文件中搜集shell的设置./etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取.~/.bash_...
分类:
其他好文 时间:
2014-10-12 14:10:57
阅读次数:
163
需求:输入用户名和密码,认证成功后显示欢迎信息,输错三次后锁定shell:#!/bin/bash
#Authuserlogin
user="hlf"
pass="123456"
lock_file=login.lock
[-f${lock_file}]||touch${lock_file}
foriin`seq3`
do
read-p"username:"username
read-p"password:"password
if[-z"$u..
分类:
其他好文 时间:
2014-10-12 11:07:18
阅读次数:
168
#!/bin/sh
# Find ip
IP=`/sbin/ifconfig eth1 | grep 'inet addr' | awk '{ print substr($2, index($2, ":")+1)}'`
#monitor procname scriptname
monitor()
{
procname=$1
scriptname=$2
# Find proc by p...
分类:
Web程序 时间:
2014-10-12 10:46:07
阅读次数:
267
最近写了一个小程序,需要用到时间,遍历作为目录的一部分
#!/bin/bash
for i in {1..30}
do
date=`date +%Y/%m/%d -d " $i days ago " `
echo $date
done
for循环,取最近n天的日期。
核心就是date=`date +%Y/%m/%d -d " $i days ago " `...
分类:
系统相关 时间:
2014-10-12 02:22:57
阅读次数:
313
sudo apt-get updatesudo apt-get install openssh-server1:ssh-keygen -t rsa -f ~/.ssh/id_rsa这里会提示输入pass phrase,一定不要输入任何字符,回车即可2:cat ~/.ssh/id_rsa.pub >>...
分类:
其他好文 时间:
2014-10-12 01:54:17
阅读次数:
261
#!/bin/sh
my_ip=`/sbin/ifconfig eth1 | grep 'inet addr' | awk '{print substr($2, index($2, ":")+1)}'`
recv=""
msg="not_existing, restart ..."
MONITOR_LOG="monitor.log"
#monitor procname scriptname...
分类:
系统相关 时间:
2014-10-11 23:25:07
阅读次数:
329
bash是linux默认命令行管理程序shell,汉澳 sinox也安装有,虽然sinox并没有默认使用bash,但是用户一旦使用就会可能被通过漏洞入侵,所以必须快速修复。虽然sinox使用freebsd 的ports,但是freebsd已经升级到最新的软件管理pkg,ports正在被淘汰,要通过portsnap直接更新到最新的ports然后用pkg安装,不过最新的ports只是在freebsd1...
分类:
系统相关 时间:
2014-10-11 22:17:57
阅读次数:
337