systemd

Ubuntu systemd custom service failing with python script

随声附和 提交于 2021-02-10 06:41:22
问题 Would like to get some help with systemd daemon service in Ubuntu. I have a python script I wrote to disable the touchscreen on a Dell XPS which is more of a problem than a useful feature. The script works but I don't want to have to launch it all the time which is why the idea came to my head to write a service file and have systemd launch it for me on startup. The issue I run into is "(code=exited, status=1/FAILURE)". This is my first time and I did a little bit of research before I tried

How to disable a Virtual Terminal in Yocto Linux

血红的双手。 提交于 2021-02-10 06:27:06
问题 Would anyone know how to disable the virtual terminals in linux? I am using Yocto, Morty version on an i.MX6 processor. Even though our base distribution is Yocto, unfortunately we have diverged from building it with recipes, so this is more of a straight linux question than Yocto… To give some detail as to my problem: It is for an embedded device that has an HDMI port - when I attach a terminal to the HDMI port it shows the Linux Penguin logo, a getty service and blanks out after 600 seconds

MongoDB 最大连接数 设置失效的异常分析

浪子不回头ぞ 提交于 2021-02-09 08:03:21
背景介绍: 查询MongoDB配置参数,可以知道关于最大连接数的参数是maxConns。但是连接实例后,查看支持的最大连接数,还是默认的819。 说明:最大连接数是由maxConn (maxIncomingConnections)和操作系统单个进程能打开的最大文件描述符数总量的80%决定的,取两个之间的最小值。默认单个进程能打开的最大文件描述符数为1024,1024*80% = 819.2 取整数819。所以最大可以支持的并发连接数为819。 案例重现 以下为本次测试MongoDB案例配置的参数。 启动后查看最大连接数。 运行命令:db.serverStatus().connections Current表示当前到实例上正在运行的连接数。 Available表示当前实例还可以支持的并发连接数。 也就是说此实例最大能支持的并发连接数为:Current+available=3+816=819. 所以设置的maxConns参数无效。 所以设置的maxConns参数无效!所以设置的maxConns参数无效!所以设置的maxConns参数无效! 答案求索 此时查看查看网上相关资料,大部分集中在 Linux系统最大文件描述符数。查看我们系统配置,此时已经是65535了。不是系统最大文件描述符数限制的了。 转个弯,因为我们是为操作系统是 centos 7

CentOS安装etcd和flannel实现Docker跨物理机通信

北城余情 提交于 2021-02-08 13:36:17
1、安装etcd yum install etcd systemctl stop etcd systemctl start etcd systemctl status etcd systemctl enable etcd ##开机自启动 查看etcd是否启动成功,etcd默认端口为2379 $ lsof -i:2379 测试etcd可用性 $ etcd --version $ etcdctl mkdir /test $ etcdctl ls / 2、安装flannel $ wget https://github.com/coreos/flannel/releases/download/v0.5.5/flannel-0.5.5-linux-amd64.tar.gz $ tar xvf flannel-0.5.5-linux-amd64.tar.gz $ cd flannel-0.5.5 $ mv flanneld /usr/bin $ mv mk-docker-opts.sh /usr/bin 启动flannel方法一: $ flanneld & 查看flannel是否启动 $ ps -ef|grep flannel 启动flannel方法二(推荐):添加到systemd服务中 a、创建配置/etc/flannel/flanneld.conf $ mkdir -p /etc

CentOS7下简单搭建Prometheus+Grafana监控系统

白昼怎懂夜的黑 提交于 2021-02-08 01:46:06
Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud. 1、Features Prometheus's main features are: a multi-dimensional data model with time series data identified by metric name and key/value pairs PromQL, a flexible query language to leverage this dimensionality no reliance on distributed storage; single server nodes are autonomous time series collection happens via a pull model over HTTP pushing time series is supported via an intermediary gateway targets are discovered via service discovery or static configuration multiple modes of graphing and

To What Extent Can One Rely on Writing to Disk When SIGTERM is Given?

妖精的绣舞 提交于 2021-02-07 08:44:42
问题 I am developing for Linux and have a daemon that should write to disk when it is killed. The daemon could be configured to listen to SIGTERM and write to disk when that signal is received. I am also familiar with the PrepareForShutdown D-Bus signal issued by the login manager. Listening to SIGTERM results in simpler code than inhibiting shutdown and listening to the PrepareForShutdown signal. Another advantage of SIGTERM is that it handles cases where the daemon is politely killed even though

Forcing work directory when executing jar file in systemd

旧巷老猫 提交于 2021-02-07 02:52:07
问题 I am attempting to start a jar from a systemd service, in linux. The jar that I am executing assumes that within the current directory, there is an xml file. I am passing the name of that file, with the -config argument. The sample service I have created is below: [Unit] Description=my service After=network.target [Service] Type=simple Environment="xml_file_name=sample.xml" ExecStart=/usr/bin/java -jar /path/to/jar/myapp.jar -config ${xml_file_name} The service file above is placed in the

Forcing work directory when executing jar file in systemd

大憨熊 提交于 2021-02-07 02:51:21
问题 I am attempting to start a jar from a systemd service, in linux. The jar that I am executing assumes that within the current directory, there is an xml file. I am passing the name of that file, with the -config argument. The sample service I have created is below: [Unit] Description=my service After=network.target [Service] Type=simple Environment="xml_file_name=sample.xml" ExecStart=/usr/bin/java -jar /path/to/jar/myapp.jar -config ${xml_file_name} The service file above is placed in the

How can a program detect if it is running as a systemd daemon?

此生再无相见时 提交于 2021-02-05 05:58:05
问题 Is there any way to detect in a program that it is run by systemd as a daemon? systemd API sd_booted() is used to detected if the whole system is booted by systemd, but says nothing about the program itself. Thanks 回答1: Get the parent process id and see whether that process is systemd . 回答2: You could set a magic environment variable in the daemon's service file and look for this variable. 来源: https://stackoverflow.com/questions/39368185/how-can-a-program-detect-if-it-is-running-as-a-systemd

Linux性能优化实战学习笔记:第三十四讲

折月煮酒 提交于 2021-02-02 07:25:18
一、上节回顾 上一节,我带你学习了 Linux 网络的基础原理。简单回顾一下,Linux 网络根据 TCP/IP模型,构建其网络协议栈。TCP/IP 模型由应用层、传输层、网络层、网络接口层等四层组 成,这也是 Linux 网络栈最核心的构成部分。 应用程序通过套接字接口发送数据包时,先要在网络协议栈中从上到下逐层处理,然后才最终送到网卡发送出去;而接收数据包时,也要先经过网络栈从下到上的逐层处理,最后送到应用程序。 了解 Linux 网络的基本原理和收发流程后,你肯定迫不及待想知道,如何去观察网络的性能情况。具体而言,哪些指标可以用来衡量 Linux 的网络性能呢? 二、性能指标 实际上,我们通常用带宽、吞吐量、延时、PPS(Packet Per Second)等指标衡量网络的性能。 带宽: 表示链路的最大传输速率,单位通常为 b/s (比特 / 秒)。 吞吐量: 表示单位时间内成功传输的数据量,单位通常为 b/s(比特 / 秒)或者B/s(字节 / 秒)。吞吐量受带宽限制,而吞吐量 / 带宽,也就是该网络的使用率。 延时: 表示从网络请求发出后,一直到收到远端响应,所需要的时间延迟。在不同场景中,这一指标可能会有不同含义。比如,它可以表示,建立连接需要的时间(比如 TCP    握手延时),或一个数据包往返所需的时间(比如 RTT)。 PPS: 是 Packet Per