我试图在login过程中使用PAM和libpam_exec运行脚本; 我已将此行添加到/etc/pam.d/下的所需文件中: auth required pam_exec.so debug log=/var/log/debug /usr/local/bin/test.sh 只是为了testing它是否工作,脚本看起来像这样: #!/bin/bash ## do nothing, except return success (allow login..) exit 0; 但是,客户端被“严重错误”拒绝,并且debugging日志报告了这个奇怪的错误: bash: xmalloc: ../bash/locale.c:73: cannot allocate 2 bytes (0 bytes allocated) 我到处寻找,并没有能够在这个特定的问题上出现任何有用的东西。debugging日志是非常模糊的,我不知道从哪里去哪里? 我想(作为最后的手段)挖掘源代码bash看看是什么在线locale.c .. 73或只是使用另一个模块…但我有多个计划pam_exec,我不特别就像执行(例如)pam_script一样。 有人有什么build议吗? 注意:运行Ubuntu 12.04 lts
我写了一个帮助程序来debugging清漆安装,并在生产和开发服务器上使用它。 奇怪的是,即使设置几乎相同(硬件除外),我遇到了不同的行为。 该命令是: varnishlog > /var/log/v1.log & curl -I $URL; kill $! 在我们的生产服务器上,它按预期工作: varnishlog作为后台进程启动,并将其输出redirect到/var/log/v1.log – 然后执行curl ,当varnishlog被终止时(尽pipe我没有看到'terminate'消息,直到下一个命令被执行)。 在我们的开发服务器上,命令执行并在crul输出后crul显示“终止”消息。 但是,/ /var/log/v1.log是空的。 这两个服务器uname -srvmo返回Linux 2.6.32-358.18.1.el6.x86_64 #1 SMP Wed Aug 28 17:19:38 UTC 2013 x86_64 GNU/Linux和两个正在运行的CentOS release 6.4 (Final) 。 编辑 :看来varnishlog > /var/log/v1.log不起作用。 varnishlog > /var/log/v1.log 2>&1或varnishlog | tee /var/log/v1.log varnishlog | tee /var/log/v1.log (后者不会将产品输出到控制台)。 其他命令(例如echo 'test' […]
我有一个脚本查询基于用户input的远程服务器,并查找文件的最后修改date。 它的工作,但是,在文件中包含一个string,我需要显示以及我所尝试的一切都是徒劳无功。 我真的很感激任何帮助。 脚本 echo "Input server name:" read server echo "Input user:" read user ssh $server "find /home/ -maxdepth 2 -name .lastlogin | xargs -l -I{} bash -c '{ stat -c \"User: %U Last Login : %y\" {} | cut -c -47 |grep $user; }'" 当前样本输出 User: owner Last Login : 2014-07-24 15:05:39 我需要这个输出来包含这个文件的内容,即.lastlogin […]
我们正在尝试编写一个脚本“sendemail.sh”来计算给定间隔内的日志文件“SendEmail.log”中特定string的出现次数。 我们有一个日志文件。 在这里,我们正在寻找一个模式“ReqInputMsgLog”,并且需要统计在给定时间内发生的次数,例如:从“2014-08-19 11:30”到“2014-08-19 11:34” 。 我们的脚本是这样的: #!/bin/sh enterdate=$1 echo $enterdate enddate=$2 enterdate1=`date +%s -d $enterdate +"%Y-%m-%d %H:%M"` echo $enterdate1 enddate1=`date +%s -d $enddate +"%Y-%m-%d %H:%M"` echo $enddate count=0 cat SendEmail.log | grep "ReqInputMsgLog" | awk -F "[" '{print $3}' | awk -F "," '{print $1}' > /con/scripts_server/file.txt for line in `cat /con/scripts_server/file.txt` do logdate=`echo […]
我尝试运行以下命令: crontab -u root /root/iss/current/node/bin/installers/nl_brandless_selector_full_hd/nl_brandless_selector_full_hd_cron_file 但是我得到这样的错误: /root/iss/current/node/bin/installers/nl_brandless_selector_full_hd/nl_brandless_selector_full_hd_c: No such file or directory 该文件存在那里,但似乎crontab截断文件path的最后几个字符,就像从错误消息看来。 这是一个错误? 操作系统:Ubuntu 12.04.2 LTS 编辑: 这里是一个“ls”输出,所以可以看到,文件存在并且可读(当我试图运行crontab命令时,我是root的): -rw-r–r– 1 root root 1707 Aug 28 00:22 /root/iss/current/node/bin/installers/nl_brandless_selector_full_hd/nl_brandless_selector_full_hd_cron_file 编辑2:如果我将文件重命名为nl_brandless_cron,它完美的工作,所以现在我敢肯定,这真的是一个讨厌的BUG
我有一个脚本,将df输出redirect到一个文件,然后通过电子邮件发送。 邮件命令设置如下: /usr/bin/mail -s "Subject" -r [email protected] [email protected] < /tmp/diskSpace.txt 当我以root用户的身份运行这个脚本时,一切正常,但是当我从根crontab运行它时,我有一个奇怪的行为。 在这种情况下,消息被传递,但是/tmp/diskSpace.txt的内容被附加到电子邮件,而不是作为正文。 我甚至试图复制运行cron的根环境: env `cat root-env-saved-to-this-file` /bin/bash mailscript.sh 但没有任何改变。 任何build议,或者我应该只用perl邮件库来处理?
我的脚本是用这个为lftp设置的 lftp -p 2218 -u $login,$pass sftp://$host << EOF set mirror:use-pget-n 5 mirror -c -P5 –depth-first –Remove-source-files –log=/home/dog/downloadsync.log $remote_dir $local_dir 它工作的很好,除了在远程目录EVERY STINKING TIME上留下空文件夹。 我已经试过没有 – –depth-first ,它仍然会离开他们。 我已经尝试在镜像之后和退出之前添加一个rmdir * ,但是如果脚本崩溃,会造成一些严重的问题[不要问这个故事]有没有解决scheme?
在Linux中运行的进程忽略除KILL以外的信号(INT,QUIT,TERM)。 如top,tail -f,sleep等程序在按Ctrl + C时不会响应,因此必须使用kill实用工具从另一个控制台停止它们。 Strace没有显示任何活动,我看到这个过程没有得到信号。 可能是什么问题呢? CentOS 6.5,内核3.10.23(从OVH Hosting定制内核)。
我在使用AD到Linux服务器上的SAMBA共享时遇到了问题。 身份validation似乎正在工作,但只有一半… [root@myserver ~]# wbinfo -a my_ad_user%password123 plaintext password authentication succeeded challenge/response password authentication succeeded [root@myserver ~]# wbinfo -i my_ad_user Could not get info for user my_ad_user << weird [root@myserver ~]# getent passwd my_ad_user my_ad_user:*:1256023472:1256023469:my name:/: [root@myserver ~]# 这很奇怪,因为看起来除了 wbinfo -i <any_ad_user_name>的输出之外 ,一切正常。 其他的wbinfo查询似乎工作得很好。 检查信任也是如此: [root@myserver ~]# wbinfo -t checking the trust secret for domain […]
用barnyard2build立了一个snort box,运行到下面的错误。 有人可以帮忙吗? $Starting Snort Output Processor (barnyard2): ./barnyard2: 35: ./barnyard2: barnyard2: not found /etc/init.d/barnyard2文件 #!/bin/sh # # Init file for Barnyard2 # # # chkconfig: 2345 40 60 # description: Barnyard2 is an output processor for snort. # # processname: barnyard2 # config: /etc/sysconfig/barnyard2 # config: /etc/snort/barnyard.conf # pidfile: /var/lock/subsys/barnyard2.pid [ -x /usr/sbin/snort ] […]