unix

How to log deployments in Deployer?

时间秒杀一切 提交于 2020-03-05 03:03:59
问题 I'm using Deployer and enjoy it. One thing I haven't figured out how to do yet though is write a log file of my deployments. I'm attempting to append the commit hash and date to revisions.txt: task('log_the_deployment', function () {//https://stackoverflow.com/a/4546755/470749 $selectedStage = Deployer::get()->getInput()->getArgument('stage'); //https://github.com/deployphp/deployer/blob/6180366acff3ca5b2ec511a84e671321c02e7af1/recipe/config/hosts.php#L15 runLocally('set -e'); //https:/

C语言-怎么找115资源

眉间皱痕 提交于 2020-03-04 22:21:54
C 语言的起源与发展 C 语言的开发 Dennis M. Ritchie Bell Labs/Lucent Technologies Murray Hill, NJ 07974 USA 摘要 C 编程语言是在 1970 年代早期作为初创的 Unix 操作系统的系统实现语言而设计的。起源于无类型的 BCPL 语言,它发展出了类型结构;它建立在一个小机器上、作为改善其贫乏的编程环境的工具,它现在已经成为占主导地位的语言之一。本文研讨它的演变。   注意: *Copyright 1993 Association for Computing Machinery, Inc. This electronic reprint made available by the author as a courtesy. For further publication rights contact ACM or the author. This article was presented at Second History of Programming Languages conference, Cambridge, Mass., April, 1993. It was then collected in the conference proceedings: History of Programming

Pass commands as input to another command (su, ssh, sh, etc)

限于喜欢 提交于 2020-03-04 21:57:44
问题 I have a script where I need to start a command, then pass some additional commands as commands to that command. I tried su echo I should be root now: who am I exit echo done. ... but it doesn't work: The su succeeds, but then the command prompt is just staring at me. If I type exit at the prompt, the echo and who am i etc start executing! And the echo done. doesn't get executed at all. Similarly, I need for this to work over ssh : ssh remotehost # this should run under my account on

Pass commands as input to another command (su, ssh, sh, etc)

一世执手 提交于 2020-03-04 21:52:50
问题 I have a script where I need to start a command, then pass some additional commands as commands to that command. I tried su echo I should be root now: who am I exit echo done. ... but it doesn't work: The su succeeds, but then the command prompt is just staring at me. If I type exit at the prompt, the echo and who am i etc start executing! And the echo done. doesn't get executed at all. Similarly, I need for this to work over ssh : ssh remotehost # this should run under my account on

Pass commands as input to another command (su, ssh, sh, etc)

余生颓废 提交于 2020-03-04 21:52:04
问题 I have a script where I need to start a command, then pass some additional commands as commands to that command. I tried su echo I should be root now: who am I exit echo done. ... but it doesn't work: The su succeeds, but then the command prompt is just staring at me. If I type exit at the prompt, the echo and who am i etc start executing! And the echo done. doesn't get executed at all. Similarly, I need for this to work over ssh : ssh remotehost # this should run under my account on

gdb调试工具的使用

北城余情 提交于 2020-03-04 15:31:03
GDB是一个由GNU开源组织发布的、UNIX/LINUX操作系统下的、基于命令行的、功能强大的程序调试工具。 GDB中的命令固然很多,但我们只需掌握其中十个左右的命令,就大致可以完成日常的基本的程序调试工作。 1.file <文件名> : 加载被调试的可执行程序文件。 因为一般都在被调试程序所在目录下执行GDB,因而文本名不需要带路径 命令:(gdb) file gdb_sample 2. r : Run的简写,运行被调试的程序。 如果此前没有下过断点,则执行完整个程序;如果有断点,则程序暂停在第一个可用断点处 命令:(gdb) r 3. b <行号> b <函数名称> b *<函数名称> b *<代码地址> d [编号] b: Breakpoint的简写,设置断点。两可以使用“行号”“函数名称”“执行地址”等方式指定断点位置。 其中在函数名称前面加“*”符号表示将断点设置在“由编译器生成的prolog代码处”。如果不了解汇编,可以不予理会此用法。 d: Delete breakpoint的简写,删除指定编号的某个断点,或删除所有断点。断点编号从1开始递增。 命令: (gdb) b 8 (gdb) b main (gdb) b *main (gdb) b *0x804835c (gdb) d 4. s,n s: 执行一行源程序代码,如果此行代码中有函数调用,则进入该函数; n:

在 php 中使用 strace、gdb、tcpdump 调试工具

Deadly 提交于 2020-03-04 15:25:35
转自:http://www.syyong.com/php/Using-strace-GDB-and-tcpdump-debugging-tools-in-PHP.html 在 php 中我们最常使用调试方式是输出打印方式,比如通过 echo、var_dump 输出信息到终端或者通过 fwrite、file_put_contents 将信息写入到文件中。这种普通方式能帮我们解决绝大部分调试问题。但仍然有些问题是需要借助其他工具来分析的,比如死循环,程序执行时间超预期,占用 cpu 过高,php 内核或者扩展错误等场景,这时如果借助 strace、gdb、tcpdump 这样的工具就能很好的去帮助我们定位问题。 strace strace 是 Linux 环境下的一款程序调试工具,用来监察一个应用程序所使用的系统调用及它所接收的系统信息。 在 Linux 中,进程是不能直接去访问硬件设备(比如读取磁盘文件,接收网络数据等等),但可以将用户态模式切换至内核态模式,通过系统调用来访问硬件设备。这时 strace 就可以跟踪到一个进程产生的系统调用,包括参数,返回值,执行消耗的时间,调用次数,成功和失败的次数。 比如我们使用 strace 来跟踪 cat 查看一个文件做了什么: [root@syyong home]$ strace cat index.php execve("/bin/cat

通过trace跟踪系统调用

╄→гoц情女王★ 提交于 2020-03-04 15:16:53
简介 strace常用来跟踪进程执行时的系统调用和所接收的信号。 在Linux世界,进程不能直接访问硬件设备,当进程需要访问硬件设备(比如读取磁盘文件,接收网络数据等等)时,必须由用户态模式切换至内核态模式,通 过系统调用访问硬件设备。strace可以跟踪到一个进程产生的系统调用,包括参数,返回值,执行消耗的时间。 输出参数含义 root@ubuntu:/usr# strace cat /dev/null execve("/bin/cat", ["cat", "/dev/null"], [/* 22 vars */]) = 0brk(0) = 0xab1000access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f29379a7000access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)...brk(0) = 0xab1000brk(0xad2000) = 0xad2000fstat(1, {st_mode=S_IFCHR|0620, st

[strace]跟踪进程的系统调用

你。 提交于 2020-03-04 15:15:02
转自 : https://www.cnblogs.com/ggjucheng/archive/2012/01/08/2316692.html 简介 strace常用来跟踪进程执行时的系统调用和所接收的信号,调试应用程序的时候经常使用 。 在Linux世界,进程不能直接访问硬件设备,当进程需要访问硬件设备(比如读取磁盘文件,接收网络数据等等)时,必须由用户态模式切换至内核态模式,通 过系统调用访问硬件设备。strace可以跟踪到一个进程产生的系统调用,包括参数,返回值,执行消耗的时间。 输出参数含义 root@ubuntu:/usr# strace cat /dev/null execve("/bin/cat", ["cat", "/dev/null"], [/* 22 vars */]) = 0brk(0) = 0xab1000access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f29379a7000access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or

strace命令

末鹿安然 提交于 2020-03-04 15:14:07
简介 strace常用来跟踪进程执行时的系统调用和所接收的信号。 在Linux世界,进程不能直接访问硬件设备,当进程需要访问硬件设备(比如读取磁盘文件,接收网络数据等等)时,必须由用户态模式切换至内核态模式,通 过系统调用访问硬件设备。strace可以跟踪到一个进程产生的系统调用,包括参数,返回值,执行消耗的时间。 输出参数含义 root@ubuntu:/usr# strace cat /dev/null execve("/bin/cat", ["cat", "/dev/null"], [/* 22 vars */]) = 0brk(0) = 0xab1000access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f29379a7000access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)...brk(0) = 0xab1000brk(0xad2000) = 0xad2000fstat(1, {st_mode=S_IFCHR|0620, st