nohup

Starting background tasks with Capistrano

佐手、 提交于 2019-11-28 21:20:29
For my RubyOnRails-App I have to start a background job at the end of Capistrano deployment. For this, I tried the following in deploy.rb: run "nohup #{current_path}/script/runner -e production 'Scheduler.start' &", :pty => true Sometimes this works, but most of the time it does not start the process (= not listed in ps -aux). And there are no error messages. And there is no nohup.out, not in the home directory and not in the rails app directory. I tried using trap('SIGHUP', 'IGNORE') in scheduler.rb instead of nohup, but the result is the same. The only way to get it work is removing the "

frps/frpc配置

夙愿已清 提交于 2019-11-28 19:18:43
-------------------------------------------------------------------------- 1、后台运行frp服务 服务端: nohup ./frps -c frps.ini >/dev/null 2>&1 & 客户端: nohup ./frpc -c frpc.ini >/dev/null 2>&1 & 说明:>/dev/null 2>&1 &,表示丢弃。 https://blog.csdn.net/woaiyaou/article/details/83359799 https://github.com/fatedier/frp frps [common] server_addr = 0.0.0.0 bind_port = 7000 dashboard_port = 7500 vhost_http_port = 80 auth_token = meiyoumima dashboard_user = shabake dashboard_pwd = adsl2100e [ssh] type = tcp local_ip = 127.0.0.1 local_port = 6801 ./frps -c ./frps.ini #服务端启动 ----------------------------------------------

nohup 日志按天输出

寵の児 提交于 2019-11-28 17:47:23
输出日志在当前目录: nohup java -jar ace-auth.jar >> nohup`date +%Y-%m-%d`.out 2>&1 & 指定日志目录输出: 指定输出到当前目录log文件夹中 nohup java -jar ace-auth.jar >> ./log/nohup`date +%Y-%m-%d`.out 2>&1 & 来源: https://www.cnblogs.com/jin-521/p/11417505.html

how to run a command in background using ssh and detach the session

不打扰是莪最后的温柔 提交于 2019-11-28 16:32:16
问题 I'm currently trying to ssh into a remote machine and run a script, then leave the node with the script running. Below is my script. However, when it runs, the script is successfully run on the machine but ssh session hangs. What's the problem? ssh -x $username@$node 'rm -rf statuslist mkdir statuslist chmod u+x ~/monitor/concat.sh chmod u+x ~/monitor/script.sh nohup ./monitor/concat.sh & exit;' 回答1: There are some situations when you want to execute/start some scripts on a remote machine

How to kill a nohup process?

醉酒当歌 提交于 2019-11-28 15:39:09
问题 I executed the following command $ nohup ./tests.run.pl 0 & now when I try to kill it (and the executions that are started from this script) using $ kill -0 <process_id> it does not work. How can I kill a nohupped process and the processes that runs via the nohupped script? Thanks 回答1: kill -0 does not kill the process. It just checks if you could send a signal to it. Simply kill pid , and if that doesn't work, try kill -9 pid . 回答2: Simply kill <pid> which will send a SIGTERM , which nohup

Call a function using nohup

无人久伴 提交于 2019-11-28 11:57:21
I am trying to call a function using nohup like this: function1(){ while true do echo "function1" sleep 1 done } nohup function1 & # ...... some other code but may be the function isn't seen by nohup and I get this error: nohup: failed to run command `function1' : No such file or dictionary I don't want to create new sh file for my function. How can I fix this? Another solution: function background { echo TEST } export -f background nohup bash -c background & nohup applies to commands and not to script functions. For example, the script (say func.sh) that contains function1() should call the

nohup 、&、 2>&1 命令分析

孤街醉人 提交于 2019-11-28 08:58:14
nohup的意思是不间断的运行,&的意思是后台运行,2>&1的意思是标准输出和错误输出都重定向到同一个文件。 简单地说nohup运行时即使关掉控制台,它该运行还是运行。 https://blog.csdn.net/liuyanfeier/article/details/62422742 讲解的比较透彻,我给他做一点补充 可以参考 https://www.jianshu.com/p/747e0d5021a2 nohup 命令分析 先假设一个情况,想要后台运行一个命令怎么办?最好的办法是用 & ,在命令的结尾加一个 & 就可以在后台运行了。 & 实例解析 假设有一个python程序叫做123.py 代码是这个样子,一直去输出一些东西。 import time a = 1 while True: print("start to print sth") a+=1 print("a=%s" %(a)) time.sleep(2) 如果运行它的话需要 python3 123.py ,可以把正确的内容重定向到log.txt。这个时候命令就是 python3 123.py > log.txt 运行后,控制台一直是这个样子,无法进行其他的操作。 su@DESKTOP-FA1P4IO:~$ python3 123.py >> log.txt 后面加一个 & 后就可以进行操作别的东西了。

SpringBoot电商项目实战 — 前后端分离后的优雅部署及Nginx部署实现

落花浮王杯 提交于 2019-11-28 07:34:35
在如今的SpringBoot微服务项目中,前后端分离已成为业界标准使用方式,通过使用nginx等代理方式有效的进行解耦,并且前后端分离会为以后的大型分布式架构、弹性计算架构、微服务架构、多端化服务(多个客户展现端,例如:web端,安卓app,IOSapp,微信小程序等)打下坚实的基础。这个步骤是系统架构从猿进化成人的必经之路。 image 上图是简单的分布式微服务开发及前后端分离的示意图。展现层也就是所谓的前端(客户可直观看到的),比如电商项目前端包含:app(安卓和IOS)、微信小程序、PC商城、Web后台。后端是整个项目的核心,也就是系列项目中讲的内容,后端用Springboot+Dubbo实现分布式开发微服务落地,服务实现层的每一个服务都是一个独立部署的应用,并提供服务(Dubbo的提供者),接口层根据前端的请求,然后找对应的服务提供者消费服务。 在前后端分离的应用模式中,后端仅返回前端所需的数据,不再渲染HTML页面,不再控制前端的效果。至于前端用户看到什么效果,从后端请求的数据如何加载到前端中,都由前端自己决定,网页有网页的处理方式,各自有各自的处理方式,但无论哪种前端,所需的数据基本相同,后端仅需开发一套逻辑对外提供数据即可。前端(Web项目)分离处理,都是从原先的JSP转成了Html静态页面。 Web项目部署容器的选取 目前常用的部署Web项目的容器用Tomcat

linux后台运行命令

时间秒杀一切 提交于 2019-11-28 05:08:46
  linux批处理文件*.sh的执行往往需要在连接客户端上执行(企业使用云服务器居多)。然而,当脚本文件执行时间过长或操作员当前并不关心命令立即生效的情况下,一直开着连接客户端占用一个窗口,并不是很合适。于是,就可以使用本文提到的方法进行处理:将脚本以后台进程方式运行。 一、直奔主题   (1)需要linux命令以后台进程方式执行的方法很简单,只需要在执行命令之后加上一个&即可。例如: #获取当前进程状况,并将结果输出到a.txt ps -ef > a.txt #以后台方式执行命令 ps -ef > a.txt &      (2)如果还有日志输出的需求,那么可以添加使用nohup命令。例如: nohup ps -ef > a.txt &  这个命令将执行任务的所有控制台输出记录至 当前目录下nohup.out 文件中。若该文件不可写,则会写到 ~/nohup.out 中。   二、进程管理   命令开始执行之后,如何停止和查看命令执行情况就成了问题。linux为使用者提供了如下几个命令用于查询进程状态:     job -l       查看当前用户后台执行进程     ps -aux(ps -ef,mac上的ps命令没有x选项)       查看服务器上所有进程       备注:         awk可以提取输出行信息,例如:          ps -aux| grep

linux命令后台运行

戏子无情 提交于 2019-11-28 05:08:14
有两种方式: 1. command & : 后台运行,你关掉终端会停止运行 2. nohup command & : 后台运行,你关掉终端也会继续运行 一、 简介 Linux/Unix 区别于微软平台最大的优点就是真正的多用户,多任务。因此在任务管理上也有别具特色的管理思想。 我们知道,在 Windows 上面,我们要么让一个程序作为服务在后台一直运行,要么停止这个服务。而不能让程序在前台后台之间切换。而 Linux 提供了 fg 和bg 命令,让你轻松调度正在运行的任务。假设你发现前台运行的一个程序需要很长的时间,但是需要干其他的事情,你就可以用 Ctrl-Z ,挂起这个程序,然后可以看到系统提示: [1]+ Stopped /root/bin/rsync.sh 然后我们可以把程序调度到后台执行:(bg 后面的数字为作业号) #bg 1 [1]+ /root/bin/rsync.sh & 用 jobs 命令查看正在运行的任务: #jobs [1]+ Running /root/bin/rsync.sh & 如果想把它调回到前台运行,可以用 #fg 1 /root/bin/rsync.sh 这样,你在控制台上就只能等待这个任务完成了。 & 将指令丢到后台中去执行 [ctrl]+z 將前台任务丟到后台中暂停 jobs 查看后台的工作状态 fg %jobnumber