upstart

What's the proper way to run some Python code asynchronously?

ぐ巨炮叔叔 提交于 2019-12-04 08:31:37
问题 I needed to send mail from my plain Flask app, so I thought the simplest way would be to send it using smtplib. But I had to do it asynchronously - you can't just insert a 3 second delay into the request - right? So I add the email to a queue (psql table), and send it from another program that reads this table and uses smptlib. This second program (maildonkey) is running as a separate process, in an independent upstart service. Now I need another one of those little asynchoronous services,

Upstart script to run container won't manage lifecycle

折月煮酒 提交于 2019-12-03 20:26:30
I have an upstart script (say, /etc/init/dtest.conf ) start on runlevel [2345] stop on runlevel [!2345] respawn script DID=$(docker.io run -d ubuntu /bin/bash -c "echo Starting;sleep 20;echo Stopping") docker.io attach $DID end script When issuing start dtest , the upstart logs show the proper cycle of "Starting ... Stopping" forever. However, if I issue a stop dtest , then it appears to exit properly, but the container will run for the remainder of the sleep time (as evidenced by running docker.io ps every second). Shouldn't there be an easy way to run a docker image in a container with

Can upstart expect/respawn be used on processes that fork more than twice?

倖福魔咒の 提交于 2019-12-03 16:36:54
问题 I am using upstart to start/stop/automatically restart daemons. One of the daemons forks 4 times. The upstart cookbook states that it only supports forking twice. Is there a workaround? How it fails If I try to use expect daemon or expect fork , upstart uses the pid of the second fork. When I try to stop the job, nobody responds to upstarts SIGKILL signal and it hangs until you exhaust the pid space and loop back around. It gets worse if you add respawn. Upstart thinks the job died and

how to automatically restart a node server?

纵然是瞬间 提交于 2019-12-03 09:27:58
We are finishing development of a project, the client is already using it but occasionally some errors occur - crashing the server. I know I could register a service as 'upstart' script on linux, in order to have my node service restart when it crashes. But our server is running other stuff, so we can't restart it. Well, actually, while writing, I realize I have two questions then: Will 'upstart' work without having to reboot? Something is just whispering yes to me :) If not, what other option would I have to 'respawn' my node server when it crashes? Yes, upstart will restart your process

Can upstart expect/respawn be used on processes that fork more than twice?

*爱你&永不变心* 提交于 2019-12-03 05:08:10
I am using upstart to start/stop/automatically restart daemons. One of the daemons forks 4 times. The upstart cookbook states that it only supports forking twice. Is there a workaround? How it fails If I try to use expect daemon or expect fork , upstart uses the pid of the second fork. When I try to stop the job, nobody responds to upstarts SIGKILL signal and it hangs until you exhaust the pid space and loop back around. It gets worse if you add respawn. Upstart thinks the job died and immediately starts another one. Bug acknowledged by upstream A bug has been entered for upstart. The

Upstart script for node.js app

自闭症网瘾萝莉.ら 提交于 2019-12-03 02:36:11
I'm having trouble starting an Upstart script. Here's the script (app.conf in /etc/init/) description "node.js server" author "kvz" start on startup stop on shutdown script # We found $HOME is needed. Without it, we ran into problems export HOME="/root" exec sudo -u /usr/local/bin/node \ /var/www/vhosts/travelseguro.com/node/app.js \ 2>&1 >> /var/log/node.log end script When I run sudo start app , I get: start: Unknown job: app How can I make this work? Jujhar Singh I was having the same problem running on the latest Amazon (AWS) linux which is Redhat based. I have my upstart file in /etc/init

How to use foreman to export to upstart?

孤街浪徒 提交于 2019-12-03 01:36:17
I am trying to export my application to another process management format/system (specifically, upstart ). In doing so, I have come across a number of roadblocks, mostly due to lacking documentation. As a non-root user, I ran the following command (as shown here ): -bash> foreman export upstart /etc/init ERROR: Could not create: /etc/init I "could not create" the directory due to inadequate permissions, so I used sudo : -bash> sudo foreman export upstart /etc/init Password: ERROR: Could not chown /var/log/app to app I "could not chown... to app" because there is no user named app . Where is

Increase max open files for Ubuntu/Upstart (initctl)

南笙酒味 提交于 2019-12-02 20:55:26
This is on an Ubuntu 12.04.3 LTS server. I've added the following to /etc/security/limits.conf (my Golang processes run as root): * hard nofile 50000 * soft nofile 50000 root hard nofile 50000 root soft nofile 50000 I've added the following to /etc/pam.d/common-session session required pam_limits.so I've added the following to /etc/sysctl.conf: fs.file-max = 50000 Yet when I cat /proc/{PID}/limits, I get: Limit Soft Limit Hard Limit Units Max open files 1024 4096 files This happens only when I start the process from Upstart via sudo initctl start service_name . If I start the process myself,

Node.js upstart vs forever

徘徊边缘 提交于 2019-12-02 20:53:33
I am looking to daemonize my Node.js application. What's the difference between upstart and forever? Also, are there other packages I might want to considering looking at? As pointed out in the comments, upstart will be used to start the forever script, since upstart has hooks for system events (like shutdown and startup of your server). The other differences are: Upstart was developed for Linux, while forever is platform-independent. Forever is specific to nodejs, and has some pretty cool features with regards to restarting your server after it crashes, and logging. Forever is sufficient for

Upstart calling script (for inserted USB-drive)

爱⌒轻易说出口 提交于 2019-12-02 19:42:57
I know that Ubuntu (and Fedora) uses Upstart istead of the classical System V init daemon (SysVinit). I would like to know how to detect when a USB-drive has been inserted, mount it and copy some files to it. I would like Upstart to call my own script for this. If it is possible I would like Upstart to call the script for a specific USB-drive, so that I would get normal functionality for every USB-drive except my "instant backup" USB-drive. If Upstart could send the USB-drive identification string as an argument to my script I guess that would be the ideal solution, as I would be able to have