久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='3TzGy'><style id='3TzGy'><dir id='3TzGy'><q id='3TzGy'></q></dir></style></legend>

      <tfoot id='3TzGy'></tfoot>
          <bdo id='3TzGy'></bdo><ul id='3TzGy'></ul>

        <small id='3TzGy'></small><noframes id='3TzGy'>

        <i id='3TzGy'><tr id='3TzGy'><dt id='3TzGy'><q id='3TzGy'><span id='3TzGy'><b id='3TzGy'><form id='3TzGy'><ins id='3TzGy'></ins><ul id='3TzGy'></ul><sub id='3TzGy'></sub></form><legend id='3TzGy'></legend><bdo id='3TzGy'><pre id='3TzGy'><center id='3TzGy'></center></pre></bdo></b><th id='3TzGy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3TzGy'><tfoot id='3TzGy'></tfoot><dl id='3TzGy'><fieldset id='3TzGy'></fieldset></dl></div>
      1. 通過(guò) os.system 推送

        pushd through os.system(通過(guò) os.system 推送)
      2. <legend id='8ou3c'><style id='8ou3c'><dir id='8ou3c'><q id='8ou3c'></q></dir></style></legend>
      3. <small id='8ou3c'></small><noframes id='8ou3c'>

          <i id='8ou3c'><tr id='8ou3c'><dt id='8ou3c'><q id='8ou3c'><span id='8ou3c'><b id='8ou3c'><form id='8ou3c'><ins id='8ou3c'></ins><ul id='8ou3c'></ul><sub id='8ou3c'></sub></form><legend id='8ou3c'></legend><bdo id='8ou3c'><pre id='8ou3c'><center id='8ou3c'></center></pre></bdo></b><th id='8ou3c'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8ou3c'><tfoot id='8ou3c'></tfoot><dl id='8ou3c'><fieldset id='8ou3c'></fieldset></dl></div>
            <tbody id='8ou3c'></tbody>
              <tfoot id='8ou3c'></tfoot>

                • <bdo id='8ou3c'></bdo><ul id='8ou3c'></ul>
                • 本文介紹了通過(guò) os.system 推送的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我正在使用 crontab 為我的 minecraft 服務(wù)器運(yùn)行維護(hù)腳本.大多數(shù)時(shí)候它工作正常,除非 crontab 嘗試使用重啟腳本.如果我手動(dòng)運(yùn)行重新啟動(dòng)腳本,則沒(méi)有任何問(wèn)題.因?yàn)槲蚁嘈潘c路徑名有關(guān),所以我試圖確保它總是從 minecraft 目錄執(zhí)行任何 minecraft 命令.所以我將命令封裝在 pushd/popd 中:

                  I'm using a crontab to run a maintenance script for my minecraft server. Most of the time it works fine, unless the crontab tries to use the restart script. If I run the restart script manually, there aren't any issues. Because I believe it's got to do with path names, I'm trying to make sure it's always doing any minecraft command FROM the minecraft directory. So I'm encasing the command in pushd/popd:

                  os.system("pushd /directory/path/here")
                  os.system("command to sent to minecraft")
                  os.system("popd")
                  

                  下面是一個(gè)交互式會(huì)話,將我的世界從等式中剔除.一個(gè)簡(jiǎn)單的ls"測(cè)試.如您所見(jiàn),它根本沒(méi)有從 pushd 目錄運(yùn)行 os.system 命令,而是從/etc/運(yùn)行 python 來(lái)說(shuō)明我的觀點(diǎn)的目錄.顯然 pushd 不能通過(guò) python 工作,所以我想知道我還能如何實(shí)現(xiàn)這一目標(biāo).謝謝!

                  Below is an interactive session taking minecraft out of the equation. A simple "ls" test. As you can see, it does not at all run the os.system command from the pushd directory, but instead from /etc/ which is the directory in which I was running python to illustrate my point.Clearly pushd isn't working via python, so I'm wondering how else I can achieve this. Thanks!

                  >>> def test():
                  ...     import os
                  ...     os.system("pushd /home/[path_goes_here]/minecraft")
                  ...     os.system("ls")
                  ...     os.system("popd")
                  ... 
                  >>> test()
                  ~/minecraft /etc
                  DIR_COLORS    cron.weekly  gcrypt         inputrc    localtime   mime.types         ntp       ppp         rc3.d       sasldb2         smrsh      vsftpd.ftpusers
                  DIR_COLORS.xterm  crontab      gpm-root.conf      iproute2   login.defs  mke2fs.conf            ntp.conf      printcap        rc4.d       screenrc        snmp       vsftpd.tpsave
                  X11       csh.cshrc    group          issue      logrotate.conf  modprobe.d         odbc.ini      profile         rc5.d       scsi_id.config  squirrelmail   vz
                  adjtime       csh.login    group-         issue.net  logrotate.d     motd               odbcinst.ini  profile.d       rc6.d       securetty       ssh        warnquota.conf
                  aliases       cyrus.conf   host.conf      java       lvm         mtab               openldap      protocols       redhat-release  security        stunnel        webalizer.conf
                  alsa          dbus-1       hosts          jvm        lynx-site.cfg   multipath.conf         opt       quotagrpadmins  resolv.conf     selinux         sudoers        wgetrc
                  alternatives      default      hosts.allow    jvm-commmon    lynx.cfg    my.cnf             pam.d         quotatab        rndc.key        sensors.conf    sysconfig      xinetd.conf
                  bashrc        depmod.d     hosts.deny     jwhois.conf    mail        named.caching-nameserver.conf  passwd        rc          rpc         services        sysctl.conf    xinetd.d
                  blkid         dev.d        httpd          krb5.conf  mail.rc     named.conf         passwd-       rc.d        rpm         sestatus.conf   termcap        yum
                  cron.d        environment  imapd.conf     ld.so.cache    mailcap     named.rfc1912.zones        pear.conf     rc.local        rsyslog.conf    setuptool.d     udev       yum.conf
                  cron.daily    exports      imapd.conf.tpsave  ld.so.conf     mailman     netplug            php.d         rc.sysinit      rwtab       shadow          updatedb.conf  yum.repos.d
                  cron.deny     filesystems  init.d         ld.so.conf.d   makedev.d   netplug.d          php.ini       rc0.d       rwtab.d         shadow-         vimrc
                  cron.hourly   fonts        initlog.conf   libaudit.conf  man.config  nscd.conf          pki       rc1.d       samba       shells          virc
                  cron.monthly      fstab        inittab        libuser.conf   maven       nsswitch.conf          postfix       rc2.d       sasl2       skel        vsftpd
                  sh: line 0: popd: directory stack empty
                  

                  ===(CentOS 服務(wù)器與 python 2.4)

                  === (CentOS server with python 2.4)

                  推薦答案

                  每個(gè) shell 命令都在單獨(dú)的進(jìn)程中運(yùn)行.它生成一個(gè) shell,執(zhí)行 pushd 命令,然后 shell 退出.

                  Each shell command runs in a separate process. It spawns a shell, executes the pushd command, and then the shell exits.

                  只需在同一個(gè) shell 腳本中編寫(xiě)命令:

                  Just write the commands in the same shell script:

                  os.system("cd /directory/path/here; run the commands")
                  

                  更好的(也許)方法是使用 subprocess 模塊:

                  A nicer (perhaps) way is with the subprocess module:

                  from subprocess import Popen
                  Popen("run the commands", shell=True, cwd="/directory/path/here")
                  

                  這篇關(guān)于通過(guò) os.system 推送的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個(gè)模塊和類(lèi))
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點(diǎn)包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復(fù)導(dǎo)入頂級(jí)名稱(chēng)的情況下構(gòu)造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發(fā)帶有已編譯動(dòng)態(tài)共享庫(kù)的 Python 包)
                      <i id='MjLH8'><tr id='MjLH8'><dt id='MjLH8'><q id='MjLH8'><span id='MjLH8'><b id='MjLH8'><form id='MjLH8'><ins id='MjLH8'></ins><ul id='MjLH8'></ul><sub id='MjLH8'></sub></form><legend id='MjLH8'></legend><bdo id='MjLH8'><pre id='MjLH8'><center id='MjLH8'></center></pre></bdo></b><th id='MjLH8'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='MjLH8'><tfoot id='MjLH8'></tfoot><dl id='MjLH8'><fieldset id='MjLH8'></fieldset></dl></div>
                      • <bdo id='MjLH8'></bdo><ul id='MjLH8'></ul>

                      • <small id='MjLH8'></small><noframes id='MjLH8'>

                          <tbody id='MjLH8'></tbody>
                          <tfoot id='MjLH8'></tfoot>

                        1. <legend id='MjLH8'><style id='MjLH8'><dir id='MjLH8'><q id='MjLH8'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 亚洲精品第一页 | 久久久久黑人 | 精品国产不卡一区二区三区 | 国产黄色大片 | 不卡一区二区三区四区 | 日韩欧美高清 | 日韩在线精品视频 | 免费一区二区三区在线视频 | 国产免费一区二区三区免费视频 | 嫩草视频入口 | 欧美在线a | 日韩av在线免费 | 国产乱肥老妇国产一区二 | 欧美成人a∨高清免费观看 老司机午夜性大片 | 四虎最新视频 | 日韩欧美视频 | 波多野结衣电影一区 | 亚洲a视 | 欧美在线亚洲 | 日韩久久久久久 | 亚洲欧美激情网 | 欧美一级特黄aaa大片在线观看 | 日本久久精品视频 | av片在线观看 | 91视视频在线观看入口直接观看 | 欧美精品1区| 91视频. | 亚洲精品一区中文字幕乱码 | 久久精品欧美一区二区三区麻豆 | 日韩三级在线 | 欧美精品在线播放 | 不卡一二三区 | 日韩一区二区三区av | 狠狠ri | 中文二区| av黄色片在线观看 | 国产精久久久久久 | 欧美性jizz18性欧美 | 欧美大片久久久 | 精品综合久久 | 精品一区二区三区在线视频 |