cygwin是个很好用的东西,问题是,我们想让系统自动化启动一些东西,
比如在windows启动时,调用cygwin的脚本、启动cygwin里的nginx,启动
windows的MySQL数据库等。
这时就需要通过windows直接运行cygwin里的脚本或命令了
有些哥们确把很多事都想好了。
以下第一种方案经测试可行,可以直接启动nginx,执行脚本。
方案一
Running a shell Script Directly from windows
Running a shell Script Directly from windows
From: Fred Kulack <kulack at us dot ibm dot com>
To: cygwin at cygwin dot com
Date: Thu, 8 Jul 2004 11:14:28 -0500
Subject: Re: Running a shell Script Directly from windows
I have had the best luck using the 'run' utility to avoid extra
consoles and other 'shtuff' like that.
Haven't seen any doc about it though so it may disappear.
Dunno the details.
For example, I create a shortcut for running X so that I don't
get the extra console window where bash ran...
That shortcut runs this:
C:\cygwin\usr\X11R6\bin\run.exe bash --login -c startx
Clearly your path needs to be setup correctly.
"The stuff we call "software" is not like anything that human society
is used to thinking about. Software is something like a machine, and
something like mathematics, and something like language, and
something like thought, and art, and information...
but software is not in fact any of those other things."
Bruce Sterling - The Hacker Crackdown
Fred A. Kulack - IBM eServer iSeries - Enterprise Application Solutions
ERP, Java DB2 access, Jdbc, JTA, etc...
IBM in Rochester, MN (Phone: 507.253.5982 T/L 553-5982)
mailto:kulack/us.ibm.com Personal: mailto:kulack/magnaspeed.net
AIM Home:FKulack AIM Work:FKulackWrk
MSN Work: fakulack/hotmail.com (replace email / with @)
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
方案二
Running a shell Script Directly from windows
Re: Running a shell Script Directly from windows
From: Brian Dessent <brian at dessent dot net>
To: cygwin at cygwin dot com
Date: Wed, 07 Jul 2004 19:32:24 -0700
Subject: Re: Running a shell Script Directly from windows
Organization: My own little world...
References: <Pine.LNX.4.44.0407072102550.1460-100000@ccc3.wpi.edu>
Reply-to: cygwin at cygwin dot com
Scott Emerson Longley wrote:
> I am wondering if Cygwin provides a way to run shell scripts or other
> programs that run within Cygwin, directly from windows (or a .bat). In
> other words, I would like to double-click something on my desktop and have
> it run the shell script. I have fooled a little with bash command-line
> options and whatnot, but to no avail. Any insight or URL's that lead to an
> answer would be greatly appreciated.
Create a shortcut that runs "sh.exe /path/to/script.sh". When you click
on it your script will run in a command window. If your cygwin bin
directory is not in your path then the shortcut will have to include it,
i.e. "c:\cygwin\bin\sh.exe /home/foo/bar.sh". The executable's location
is a Windows path, the args to it are POSIX paths. If the script has
something other than /bin/sh in the shebang, then substitute
appropriately.
Brian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
通过cygwin脚本启动和停止MySQL、tomcat、nginx
Unix/Linux下一般想让某个程序在后台运行,很多都是使用 & 在程序结尾来让程序自动运行。比如我们要运行mysql在后台:
/usr/local/mysql/bin/mysqld_safe --user=mysql &
但是我们很多程序并不象mysqld一样可以做成守护进程,可能我们的程序只是普通程序而已,一般这种程序即使使用 & 结尾,如果终端关闭,那么程序也会被关闭。为了能够后台运行,我们需要使用nohup这个命令,比如我们有个start.sh需要在后台运行,并且希望在后台能够一直运行,那么就使用nohup:
nohup /root/start.sh &
在shell中回车后提示:
比如在windows启动时,调用cygwin的脚本、启动cygwin里的nginx,启动
windows的MySQL数据库等。
这时就需要通过windows直接运行cygwin里的脚本或命令了
有些哥们确把很多事都想好了。
以下第一种方案经测试可行,可以直接启动nginx,执行脚本。
方案一
D:\cygwin64\bin\run bash --login -c /home/someuser/shell/runs.sh
Running a shell Script Directly from windows
引用
Running a shell Script Directly from windows
From: Fred Kulack <kulack at us dot ibm dot com>
To: cygwin at cygwin dot com
Date: Thu, 8 Jul 2004 11:14:28 -0500
Subject: Re: Running a shell Script Directly from windows
I have had the best luck using the 'run' utility to avoid extra
consoles and other 'shtuff' like that.
Haven't seen any doc about it though so it may disappear.
Dunno the details.
For example, I create a shortcut for running X so that I don't
get the extra console window where bash ran...
That shortcut runs this:
C:\cygwin\usr\X11R6\bin\run.exe bash --login -c startx
Clearly your path needs to be setup correctly.
"The stuff we call "software" is not like anything that human society
is used to thinking about. Software is something like a machine, and
something like mathematics, and something like language, and
something like thought, and art, and information...
but software is not in fact any of those other things."
Bruce Sterling - The Hacker Crackdown
Fred A. Kulack - IBM eServer iSeries - Enterprise Application Solutions
ERP, Java DB2 access, Jdbc, JTA, etc...
IBM in Rochester, MN (Phone: 507.253.5982 T/L 553-5982)
mailto:kulack/us.ibm.com Personal: mailto:kulack/magnaspeed.net
AIM Home:FKulack AIM Work:FKulackWrk
MSN Work: fakulack/hotmail.com (replace email / with @)
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
方案二
Running a shell Script Directly from windows
引用
Re: Running a shell Script Directly from windows
From: Brian Dessent <brian at dessent dot net>
To: cygwin at cygwin dot com
Date: Wed, 07 Jul 2004 19:32:24 -0700
Subject: Re: Running a shell Script Directly from windows
Organization: My own little world...
References: <Pine.LNX.4.44.0407072102550.1460-100000@ccc3.wpi.edu>
Reply-to: cygwin at cygwin dot com
Scott Emerson Longley wrote:
> I am wondering if Cygwin provides a way to run shell scripts or other
> programs that run within Cygwin, directly from windows (or a .bat). In
> other words, I would like to double-click something on my desktop and have
> it run the shell script. I have fooled a little with bash command-line
> options and whatnot, but to no avail. Any insight or URL's that lead to an
> answer would be greatly appreciated.
Create a shortcut that runs "sh.exe /path/to/script.sh". When you click
on it your script will run in a command window. If your cygwin bin
directory is not in your path then the shortcut will have to include it,
i.e. "c:\cygwin\bin\sh.exe /home/foo/bar.sh". The executable's location
is a Windows path, the args to it are POSIX paths. If the script has
something other than /bin/sh in the shebang, then substitute
appropriately.
Brian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
rem window调用cygwin脚本 @echo off if "%1" neq "stop" ( goto startSys ) else ( goto stopSys ) :startSys echo 启动系统。。。 D:\cygwin64\bin\run bash --login -c /home/someone/shell/runs.sh -wait goto end :stopSys echo 停止系统。。。 D:\cygwin64\bin\run bash --login -c /home/someone/shell/stop.sh -wait goto end :end echo 执行完成。。。
通过cygwin脚本启动和停止MySQL、tomcat、nginx
#!/bin/bash #/home/someuser/shell/runs.sh if [ "$1" != "stop" ]; then echo start now . . . # start msyql echo start mysql . . . /cygdrive/d/mysql-5.6.10-winx64/bin/mysqld & #start tomcat echo start tomcat7 . . . net start "tomcat7" # start nginx echo start nginx . . . /usr/local/nginx/sbin/nginx.exe else echo stop now . . . # stop msyql echo stop mysql . . . /cygdrive/d/mysql-5.6.10-winx64/bin/mysqladmin -uroot -proot shutdown & #stop tomcat echo stop tomcat7 . . . net stop "tomcat7" # stop nginx echo stop nginx . . . /usr/local/nginx/sbin/nginx.exe -s stop fi echo done . . .
Unix/Linux下一般想让某个程序在后台运行,很多都是使用 & 在程序结尾来让程序自动运行。比如我们要运行mysql在后台:
/usr/local/mysql/bin/mysqld_safe --user=mysql &
但是我们很多程序并不象mysqld一样可以做成守护进程,可能我们的程序只是普通程序而已,一般这种程序即使使用 & 结尾,如果终端关闭,那么程序也会被关闭。为了能够后台运行,我们需要使用nohup这个命令,比如我们有个start.sh需要在后台运行,并且希望在后台能够一直运行,那么就使用nohup:
nohup /root/start.sh &
在shell中回车后提示:
发表评论
-
linux 安装mysql多个实例
2020-03-13 15:47 358mysql5.7.28多实例 安装mysql,不要启动 创 ... -
批量替换配置文件中的URL
2020-03-11 13:35 292find -iregex ".*/sh[a-z ... -
rsync备份和删除指定文件
2018-01-02 10:23 1963文件异地备份时,需要将本地文件合并到服务器上,且不能删除服务器 ... -
linux 定时任务crontab操作
2017-12-28 16:14 580常用参数: crontab -l //查看当前用户下 ... -
iptables 日志
2017-11-15 15:06 1305centos6.5配置了iptables的nat功能,但是不知 ... -
linux删除乱码文件
2017-09-30 11:20 632系统里好多乱码文件,删除不了 这个办法挺好 [url=htt ... -
解决vsftpd中文乱码问题
2017-08-25 10:45 0vsftpd中文乱码,通过ftp工具上传的中文文件会变为乱码J ... -
LVM常用命令
2017-08-25 10:28 531lvm 查看命令 lvs vgs pvs vgdisplay ... -
Centos7 firewalld操作
2017-08-25 10:27 540启动:# systemctl start firewall ... -
centos 添加DNAT SNAT
2017-08-25 10:19 3320外网服务器IP 101.168.200.22 开放端口8310 ... -
centos6.5 配置PXE系统
2017-08-25 09:58 682参考https://linux.cn/article-4902 ... -
centos6 tomcat 启动脚本 tomcat服务
2017-08-23 11:24 1363系统自动启动tomcat 复制该脚本到/etc/init.d/ ... -
CentOS6.5 整机备份与迁移恢复 五
2017-07-10 14:44 794修改网卡等配置 B服务器启动后,由于权限等原因会导至部分功能出 ... -
CentOS6.5 整机备份与迁移恢复 四
2017-07-07 16:52 800修改B系统引导器,正常启动B系统 选择系统安装或更新 ... -
CentOS6.5 整机备份与迁移恢复 三
2017-07-07 16:41 981恢复系统文件 使用光盘启动B服务器,进入rescue模式,进入 ... -
CentOS6.5 整机备份与迁移恢复 二
2017-07-07 16:05 1075恢复分区表和格式化分区 在B服务器上,使用同样的系统盘启动系统 ... -
CentOS6.5 整机备份与迁移恢复 一
2017-07-07 15:32 7478CentOS6.5的整机备份与迁 ... -
centos vsftpd 虚拟用户安装配置
2017-07-07 14:11 592安装vsftpd yum install -y vsftp ... -
openstack 虚拟机改IP
2017-03-31 17:17 1621虚拟环境搭建好以后,需要把实体服务器切换到虚拟机中,为了 ... -
编译安装openstack mitaka horizon
2017-03-15 15:19 1571由于openstack的rpm包 ...
相关推荐
cygwin 交叉编译的 coturn 服务器可以在windows 下运行,包含运行脚本可以直接运行。
cygwin是一个在windows平台上运行的unix模拟环境,是cygnus solutions公司开发的自由软件(该公司开发了很多好东西,著名的还有eCos,不过现已被Redhat收购)。它对于学习unix/linux操作环境,或者从unix到windows的...
Windows 上的 Céu 该存储库包含一些脚本,可用于在带有 Cygwin 的 Windows 机器上设置 Céu 和 SDL2。 按照。 特尔;博士: 使用 Cygwin 安装程序安装和以下软件包: curl、freetype2(仅限 x64 )、g++、gcc、git...
ansible-cygwin安装程序在Windows下以Cygwin安装Ansible 该Powershell脚本将下载并安装Cygwin和Ansible。 由于Ansible官方仅适用于Linux,因此有必要通过Cygwin在Windows上安装并执行它。 从Powershell运行 Set-...
Nutch 脱离Cygwin直接在Windows下运行。 修正批处理最大只能直接传9个参数的问题。
hive高版本中已经没有提供windows下的运行脚本了,使用Cygwin有些问题,配置经常出现正反斜杠的问题,资源为hive的windows下的运行脚本,下载覆盖bin目录就可以了,也可以根据自己需要选择脚本添加到bin目录中,如果...
特别是看书的时候,书上只讲解了如何在linux下运行,windows根本就没有那些命令,该怎么办呢? 方法1:python自带的IDLE编辑器 Run Module是直接运行脚本,咱不讲这个。咱讨论下面那个,Run… Customized。 如果脚本...
现在可以在/ sequoia / Standalone下找到最新版本 ...该Fortran脚本在功能上与R包中的脚本相同,但是具有部分可选的额外输出,对于调试很有用。 该代码已在装有Cygwin64和gfortran的Windows 8计算机上开发。
在Windows下编译NS2源码生成可执行exe文件,直接运行tcl脚本,无需借助虚拟机Linux或Cygwin
Irssi为Windows构建(在没有Perl的Cygwin上)。 Irssi 1.1.1构建: Windows下载: 源代码: 如何使用: 指示: 使用或解压缩软件包。 将文件夹irssi复制到系统。 例如: C:\Program Files\irssi 。 打开...
这可以通过WinSCP,ConEmu,Cygwin和bash / Windows脚本来实现。 LFTP4WIN-CORE模板由LFTP4WIN安装程序部署,并使用经过特殊配置和本地化的环境在配置的Cygwin便携式安装中应用。 它可以以本地用户的身份安装和运行...
我已成功运行的一组点文件: Ubuntu 操作系统Windows (Cygwin/Msys) 将转换为在不同平台上运行的文件模板。 一小组扩展脚本使用运行。 ##注意事项一些脚本显然经过调整,可以根据适合我的流程工作。 尽管已经做了...
Windows下需要安装Cygwin类软件且配置环境变量后运行 使用方法 1、需要修改package.json 的scrpts 加一条create 或者自定义名字 主要是为了我们在terminal中输入指令后运行对应的脚本 package.json 2、在项目根...
由于运行Nutch自带的脚本命令需要Linux的环境,所以必须首先安装Cygwin来模拟这种环境,而Cygwin本身的安装与使用也不是一件简单的事。下面,就让笔者对Nutch在Windows系统中的安装进行一番细解吧
在运行此脚本之前,您需要首先安装以下程序: g ++ 海湾合作委员会 解压缩 野牛 柔性 make(对于FreeBSD,则为gmake) makeinfo 修补 zlib标头/库 curl(适用于Cygwin / OSX / Linux / FreeBSD) wget(用于...
8、用linux或cygwin(windows下) 运行DownloadDuXiu.sh 9、当下载页数太多是,会出现需要验证码的情况。脚本会提示失败,请用浏览器翻页,并填写验证码。然后重新启动DownloadDuXiu.sh,脚本会从刚才中断的地方开始,...
这个小程序将Shell脚本和Busybox打包到单个EXE中,因此该脚本可以在任何Windows计算机上运行。 可以在脚本中包含其他文件,因此例如可以用于部署文件。 这是初始版本,可能有很多错误。 它支持Busybox-Win32和Cygwin...
该辅助项目包含脚本,Makefiles和其他工具,可轻松在Windows上编译TinyCC。 当前,它包含用于生成本机编译器的Cygwin 32/64的引导程序Makefile(运行该编译器不需要Cygwin)和用于wine的Makefile。
bash是大多数Linux系统以及Mac OS X默认的shell,它能运行于大多数类Unix风格的操作系统之上,甚至被移植到了Microsoft Windows上的Cygwin系统中,以实现Windows的POSIX虚拟接口。此外,它也被DJGPP项目移植到了MS-...
文件Retension.sh Windows 上的 SecureTransport (ST) 依赖于在 Cygwin 下运行的许多组件。 该 shell 脚本可以每天作为 cron 作业执行,它将删除所有修改时间超过 30 天的文件(或您希望实施的任何保留策略)。 您...