我是一个python开发人员,我需要在screen会话中运行本地的3-4 django项目,并且需要启动一些应用程序,比如skype、chrome、eclipse和文本文件daily status.txt。是否有任何方法只通过运行shell脚本来编写脚本来启动所有这些脚本?
#!/bin/bash
#
gnome-terminal -e "screen -dmS myapps"
#(Attach following command to one of the screen)
cd /var/opt/project1
python manage.py runserver 127.0.0.1:8001
#(Attach another command to one of the screen)
cd /var/opt/project2
python manage.py runserver 127.0.0.1:8002
#(Attach another command to one of the screen)
cd /var/opt/project3
python manage.py runserver 127.0.0.1:8003
#start my applications
eclipse
skype
gedit "/home/myname/Desktop/daily status.txt"
[...] 有人能帮我写一个shell脚本来完成这个任务吗?
发布于 2014-08-21 08:09:51
您可以执行以下操作
screen -S "DjangoRunservers" -d -m
#Do this if you don't want the first screen window to be blank
#screen -S "DjangoRunservers" -X stuff 'python /var/opt/project1/manage.py runserver 127.0.0.1:8001^M'
#Note: You get ^M by hitting Ctrl-V and the Return
screen -S "DjangoRunservers" -X screen python /var/opt/project1/manage.py runserver 127.0.0.1:8001
screen -S "DjangoRunservers" -X screen python /var/opt/project2/manage.py runserver 127.0.0.1:8002
screen -S "DjangoRunservers" -X screen python /var/opt/project3/manage.py runserver 127.0.0.1:8003在独立屏幕中启动python服务器。
在我的Mac上,要从终端运行eclipse,我必须这样做
/Applications/eclipse/eclipse我猜Skype也是如此。
https://askubuntu.com/questions/514098
复制相似问题