sudo -H -u {username} /bin/bash -c "python test.py &"

"&"  后台运行指令

本人亲测可用,切换到root权限后,指定了 lowman 用户运行 test.py 文件:

linux 指定用户 启动 程序的更多相关文章

  1. Linux指定用户运行程序

    参考:http://blog.useasp.net/archive/2015/07/29/run-command-as-different-user-on-linux.aspx 在实际中,我们有时候想 ...

  2. linux中chkconfig 启动程序顺序介绍

    1)redhat的启动方式和执行次序是: 加载内核 执行init程序 /etc/rc.d/rc.sysinit          # 由init执行的第一个脚本 /etc/rc.d/rc $RUNLE ...

  3. linux脚本: 后台启动程序并重定向输出信息脚本

    后台启动程序并重定向输出信息脚本 新建文件mstart, 写入下面代码. #!/bin/bash $1 1>/etc/null 2>&1 & 说明 1>/etc/nu ...

  4. linux 开机批量启动程序

    每天早上到公司第一件事打开电脑,打开我的qq.我的开发工具idea.在看看邮件,日复一日,变懒了.也变聪明了,写了以下一段脚本 文件名称:mystart.sh #!bin/bash #检验我的开发工具 ...

  5. Linux 普通用户启动nginx

    众所周知,apache的80端口为系统保留端口,如果通过其他非root用户启动,会报错如下: ()Permission denied: make_sock: could not bind to add ...

  6. linux设置开机启动程序?

    /etc/rc.d/init.d 是 /etc/init.d的目标链接. 如果/etc/rc.d下面没有 rc.local脚本文件, 则需要 手动创建: 而 /etc/bashrc 是在登陆bash ...

  7. [Linux]在终端启动程序关闭终端不退出的方法

    一般情况下关闭终端时,那么在这个终端中启动的后台程序也会终止,要使终端关闭后,后台程序保持执行,使用这个指令: nohup 命令 & 如:nohup test.sh & 回车,然后提示 ...

  8. Linux在终端启动程序关闭终端不退出的方法

    一般情况下关闭终端时,那么在这个终端中启动的后台程序也会终止,要使终端关闭后,后台程序保持执行,使用这个指令: nohup 命令 & 如:nohup ./studio.sh & 网上其 ...

  9. linux服务方式启动程序脚本(init.d脚本)

    这才是真正正确的让jar后台启动的脚本,网络上的各种nohoup的脚本都是临时执行一次任务用的. #!/bin/sh # # init.d script # # ### BEGIN INIT INFO ...

随机推荐

  1. [LeetCode] 632. Smallest Range Covering Elements from K Lists 覆盖K个列表元素的最小区间

    You have k lists of sorted integers in ascending order. Find the smallest range that includes at lea ...

  2. [LeetCode] 207. Course Schedule 课程清单

    There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prereq ...

  3. c++ 使用 vcpkg

    1. 打开下载地址:https://github.com/Microsoft/vcpkg 2. 直接下载到本地某个盘 3. 配置环境变量: 4. 打开下载到本地的vcpkg有可能叫vcpkg-mast ...

  4. .net core —— 控制台如何获取配置文件的内容?

    本文链接:https://blog.csdn.net/yenange/article/details/82457761参考: https://github.com/liuzhenyulive/Json ...

  5. python jieba 分词进阶

    https://www.cnblogs.com/jiayongji/p/7119072.html 文本准备 到网上随便一搜"三体全集",就很容易下载到三体三部曲的全集文本(txt文 ...

  6. hdu6546 Function

    Function \(\text{Alice}\) 有 \(n\) 个二次函数 \(F_i(x)=a_ix^2+b_ix+c_i(i \in [1,n])\). 现在他想在 \(\sum_{i=1}^ ...

  7. Prometheus 安装Alertmanager集成

    Prometheus 安装Alertmanager集成 # 下载地址 地址1:https://prometheus.io/download/ 地址2:https://github.com/promet ...

  8. Win10 CompatTelRunner.exe占用磁盘高的解决办法

    (1)在运行里输入  taskschd.msc, 打开windows计划任务 (2)参考下图在Application Experience下,1,2,3,4步骤,把所有带有 “CompatTelRun ...

  9. 解密“CDO-首席数据官”的价值、挑战及发展

    数据,不论形态.格式和类型,已经迅速成为企业最有战略意义的资产:数据资产已经成为了可以形成业务洞察及优势的战略资源,数据的体量.多样性和复杂性也正以指数级增长.就像其他重要的企业资产,数据需要适当的管 ...

  10. nginx 配置 server

    server{ listen 80; server_name test.eoews.cn; #项目文件的路径 root "D:/developer/study/PHPTutorial/WWW ...