nohup

PHP on a windows machine; Start process in background

狂风中的少年 提交于 2019-12-28 15:55:10
问题 I'm looking for the best, or any way really to start a process from php in the background so I can kill it later in the script. Right now, I'm using: shell_exec($Command); The problem with this is it waits for the program to close. I want something that will have the same effect as nohup when I execute the shell command. This will allow me to run the process in the background, so that later in the script it can be closed. I need to close it because this script will run on a regular basis and

PHP on a windows machine; Start process in background

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-28 15:54:17
问题 I'm looking for the best, or any way really to start a process from php in the background so I can kill it later in the script. Right now, I'm using: shell_exec($Command); The problem with this is it waits for the program to close. I want something that will have the same effect as nohup when I execute the shell command. This will allow me to run the process in the background, so that later in the script it can be closed. I need to close it because this script will run on a regular basis and

linux环境下nohup的执行jar

寵の児 提交于 2019-12-27 02:44:31
java -jar XXX.jar & 命令结尾没有 “&” ,则变成 “java -jar XXX.jar ” ,表示在当前ssh窗口,可按CTRL + C打断程序运行,或者直接关闭窗口,则程序直接退出 命令结尾添加 “&” ,则变成 “java -jar XXX.jar &” ,表示在当窗口关闭时,程序才会中止运行。&代表让该命令在后台执行。 nohup java -jar XXX.jar > Log.log & 或者 nohup java -jar XXX.jar >> Log.log & 命令 “nohup java -jar XXX.jar &” 部分,表示不挂断运行命令,当账户退出或终端关闭时,程序仍然运行。注意,该作业的所有输出被重定向到nohup.out的文件中。 命令 “nohup java -jar XXX.jar > Log.log &” 部分,表示不挂断运行命令,当账户退出或终端关闭时,程序仍然运行,并且该作业的所有输出被重定向到Log.log的文件中。“ > Log.log ” 该命令就是指定日志输出的文件。 ">>"表示将输出以追加的方式重定向到Log.log中。 nohup java -jar XXX.jar > Log.log 2>&1 & 或者 nohup java -jar XXX.jar >> Log.log 2>&1 & 或者 nohup

shell 编程补充

点点圈 提交于 2019-12-26 12:25:17
1 反引号可以进行命令的执行 ,如 `pwd` 会执行pwd这个命令。也可以通过$(pwd)来执行 2 $0 代表当前命令本身的路径。 3 dirname 可以读取指定路径名,并删除最后一个斜杠后的路径。比如有 dirname /opt/apps ,结果为 /opt 4 `dirname "$0" `来获取当前脚本的目录。 5 位置参数可以用 shift 命令左移。比如 shift 3 表示原来的 $4 现在变成 $1 ,原来的 $5 现在变成 $2 等等,原来的 $1 、 $2 、 $3 丢弃, $0 不移动。不带参数的 shift 命令相当于 shift 1 。 这样我们来获取参数的时候就不用一个一个数了。 6 nohup 不挂端的运行,即脱离终端运行,当我们以当前shell启动了一个命令,如果shell关闭后,那么命令就不执行了,nohup可以解决这个问题 7 & 使命令在后台运行,一般与nohup组合使用。 nohup sh commnd & 8 变量定义的等号前后不要有空格 9 ${param1:-param2} , 如果param1不为空,结果为param1, 否则为param2 10 sh -c "cmd" 可以直接执行字符串内的命令 11 使用grep 来执行进行if判断: if grep qwrewq -q info.log ;then echo 'success

crontab 日志备份定时任务

徘徊边缘 提交于 2019-12-26 03:44:25
-l选项,查看当前用户的所有定时任务: [xiluhua@vm-xiluhua][/home]$ crontab -l * * * * * /home/xiluhua/shell_script/logbk.sh -e选项,创建或修改当前用户的定时任务: [xiluhua@vm-xiluhua][/home]$ crontab -e crontab: no changes made to crontab -u选项,查看(-l),修改(-e)指定用户的定时任务,(仅root管理员可用): [root@vm-xiluhua][/home]$ crontab -u xiluhua -l * * * * * /home/xiluhua/shell_script/logbk.sh -r选项,删除定时任务 配置文件: [xiluhua@vm-xiluhua][~/shell_script]$ cat logbk.conf logbk.sh 1 /home/xiluhua/auto log 代码: [xiluhua@vm-xiluhua][~/shell_script]$ cat logbk.sh #!/bin/bash #author:xiluhua #since:20160619 #########################################################

storm/jstorm 相关命令

删除回忆录丶 提交于 2019-12-25 22:50:58
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1.启动nimbus,进程名为nimbus nohup storm nimbus & 2.启动supervisor,进程名为supervisor nohup storm supervisor & 3.启动ui,进程名为core nohup storm ui & 4.启动log nohup storm logviewer & 5.上传topo storm jar storm_topo.jar com.cjun.MainTopology myTopo storm_topo.jar:项目的jar包 com.cjun.MainTopology:主类的路径 myTopo:此topo在storm ui中显示的名称 6.杀死storm进程 先用jps查看storm进程,然后用:kill -9 x,杀死对应的进程,x为对应进程的进程号。 7.storm/jstorm杀死topo storm/jstorm kill count count为topo的名字 8.查看storm集群状况,浏览器输入网址:http://nimbus:8080 来源: oschina 链接: https://my.oschina.net/u/2260928/blog/364162

scp命令后台运行

情到浓时终转凉″ 提交于 2019-12-25 19:13:30
Linux scp 设置nohup后台运行 1.正常执行scp命令 2.输入ctrl + z 暂停任务 3.bg将其放入后台 4.disown -h 将这个作业忽略HUP信号 5.测试会话中断,任务继续运行不受影响 1.正常执行scp命令 从oradb30机器拷贝一个文件夹到oradb31机器: scp -r /u01/media/Disk1/ 192.168.1.31:/u01/media/. [root@oradb30 ~]# scp -r /u01/media/Disk1/ 192.168.1.31:/u01/media/ reverse mapping checking getaddrinfo for bogon failed - POSSIBLE BREAK-IN ATTEMPT! root@192.168.1.31's password: ... filegroup2.jar 100% 84KB 83.8KB/s 00:00 filegroup9.jar 2.输入ctrl + z 暂停任务 输入ctrl + z 暂停 [1]+ Stopped scp -r /u01/media/Disk1/ 192.168.1.31:/u01/media/ [root@oradb30 ~]# 此时查看jobs: [root@oradb30 ~]# jobs [1]+ Stopped

Bash script that will survive disconnection, but not user break

荒凉一梦 提交于 2019-12-25 11:57:27
问题 I want to write a bash script that will continue to run if the user is disconnected, but can be aborted if the user presses Ctrl+C. I can solve the first part of it like this: #!/bin/bash cmd=' #commands here, avoiding single quotes... ' nohup bash -c "$cmd" & tail -f nohup.out But pressing Ctrl+C obviously just kills the tail process, not the main body. Can I have both? Maybe using Screen? 回答1: I want to write a bash script that will continue to run if the user is disconnected, but can be

Running a JMeter script with nohup

依然范特西╮ 提交于 2019-12-24 05:55:34
问题 For the first time I'm just playing around with nohup on top of an Ubuntu server. I read few docs about nohup and got to know about the running commands with options such as nohup ./server.sh & . What I want to know is that, how should I be running the JMeter script (in headless mode) using nohup ? Following is the script I needed to run with nohup : ./jmeter.sh -n -t /home/chamith/WSO2MB/new/apache-jmeter-2.13/bin/GamesSubscriber.jmx When I tried using the normal nohup operation within the

Put php file in the background on Linux

风格不统一 提交于 2019-12-24 05:48:57
问题 I have a PHP file that checks if a field in MySQL database is empty. If the field is empty, PHP is an update. I want to color this file in the background on Linux. If a user creates a record, the PHP file in the background will be updated. My PHP code: <?php $mysqli = mysqli_connect("localhost","name","pass","database"); $query = 'UPDATE users SET permissions = "content" WHERE permissions = ""'; $n = $mysqli->query($query); $query = "SELECT * from users"; $result = $mysqli->query($query);