标签: upstart

如何测试 ubuntu 的 UPSTART 功能以查看我的脚本在被杀死时自动重新启动?

我正在使用 Ubuntu 的 upstart 功能运行我的 Python 脚本,这样如果我的 Python 脚本由于某种原因死亡或被杀死,它可以自动重新启动。

所以我决定使用 Ubuntu 的 UPSTART 特性来自动重启 Python 脚本。

在像这样创建 testing.conf 文件之后/etc/init/testing.conf-

chdir /tekooz
exec python testing.py
respawn
Run Code Online (Sandbox Code Playgroud)

我在 sudo 命令下运行以启动它,我可以看到该进程正在运行,ps ax并且我的 python 脚本也运行良好。

root@bx13:/tekooz# sudo start testing
testing start/running, process 27794
Run Code Online (Sandbox Code Playgroud)

这是我下面的python脚本-

#!/usr/bin/python
import time

while True:
    print "Hello World"
    time.sleep(5)
Run Code Online (Sandbox Code Playgroud)

但是我如何测试它以查看我的 Python 脚本是否被杀死,然后它会自动重新启动?我不能杀死PID的PID不断,如果我做的改变ps ax对我的testing.py

谁能告诉我如何测试这个场景?我只是想确保我的脚本在被杀死或死亡时可以自动重新启动。

linux ubuntu python upstart

4
推荐指数
1
解决办法
7445
查看次数

确定服务器是否使用 upstart 或 sysvinit 启动

我不是一个有经验的 linux 用户/管理员,但上周我购买了一个 raspberry,并在其上安装了一个基于 Debian 发行版的 Raspbmc。

我在尝试确定发行版用于服务的脚本时遇到了一些麻烦,我知道 init.d 脚本是在特定运行级别(rc0.d、rc1.d 等)上确定的。

我必须声明我对此有点困惑。

我的问题是,当我有新贵的 init .conf 文件时,rc0123456.d 文件仍然有效吗?引导一次只尊重一个(upstart 或 sysvinit)或同时尊重两者?

我怎样才能确定正在使用哪个?

谢谢!

linux upstart

4
推荐指数
1
解决办法
1473
查看次数

在脚本中更改用户?

我正在尝试更改用户以在启动期间执行特定命令。它无声地失败,显然没有执行 userchange,因为我可以看出命令没有执行。

我在下面显示的 initscript 中做错了什么?

respawn
console none

start on startup
stop on shutdown

script
  su -u anotheruser -c "myCommand" >> "myLogfile.log"
end script
Run Code Online (Sandbox Code Playgroud)

users su init-script upstart

2
推荐指数
1
解决办法
2万
查看次数

使用 Upstart 在启动时自动启动虚拟机 VBoxHeadless - init 和 Graceful exit

我想在 Ubuntu 14 Linux Headless Server 上启动时自动启动 VirtualBox 虚拟机。

我已@reboot通过 crontab尝试过,但该VboxHeadless命令似乎无法与@reboot. 我认为这是一个时间问题。

因此,我进行了更多研究,并被指导制作了一个 Upstart 脚本。我该怎么办?

virtualbox upstart sysvinit

2
推荐指数
1
解决办法
1万
查看次数

initctl:无法连接到 Upstart

我最近将我的服务器从 Ubuntu V14.04 升级到 V16.04,现在 systemctl 似乎不再工作了。

我需要防止传输守护程序在启动时自动启动,所以我发出命令

sudo systemctl disable transmission-daemon.service
Run Code Online (Sandbox Code Playgroud)

我得到以下回复

Synchronizing state of transmission-daemon.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install disable transmission-daemon
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
The script you are attempting to invoke has been converted to an Upstart job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'screen-cleanup' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script …
Run Code Online (Sandbox Code Playgroud)

upstart

2
推荐指数
1
解决办法
5764
查看次数

包 'upstart' 没有安装候选

当我尝试在 Debian 9 上安装 upstart 时,我得到:

# apt-get install upstart
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package upstart is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  systemd-sysv sysvinit-core

E: Package 'upstart' has no installation candidate
Run Code Online (Sandbox Code Playgroud)

Debian Wiki指出:

安装非常简单。唯一需要的软件包是新贵。

我的来源清单:

###### Debian Main Repos
deb http://deb.debian.org/debian/ stable main contrib …
Run Code Online (Sandbox Code Playgroud)

debian upstart

0
推荐指数
1
解决办法
2917
查看次数

标签 统计

upstart ×6

linux ×2

debian ×1

init-script ×1

python ×1

su ×1

sysvinit ×1

ubuntu ×1

users ×1

virtualbox ×1