[关闭]
@Zjmainstay 2015-05-07T08:37:17.000000Z 字数 3678 阅读 2387

cygwin配置

Linux cygwin


参考文档

安装cygwin

http://cygwin.com下载相应位数(32bit/64bit)的软件

安装wget

重新启动setup.exe,搜索wget,然后安装相关的

安装apt-cyg命令

  1. wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg -P /bin;chmod.exe +x /bin/apt-cyg
  2. 如果googlecode.com无法访问,可使用链接(2015-05-07更新):
  3. wget http://download.zjmainstay.cn/apt-cyg -P /bin;chmod.exe +x /bin/apt-cyg

切换源

apt-cyg -m http://mirrors.163.com/cygwin/

使用apt-cyg

apt-cyg install vim
类似ubuntu的apt-get

其他常用命令(whereis)

apt-cyg install util-linux

clear命令

apt-cyg install ncurses

make

apt-cyg install make

gcc

setup.exe 搜索gcc,全部安装

安装webbench

wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz
参考:http://blog.sina.com.cn/s/blog_6b9954cb0101allj.html

ssh/ssh-keygen

setup.exe ssh

top

apt-cyg install procps

crontab

apt-cyg install cron

安装 cron 服务

cygrunsrv -I cron -p /usr/sbin/cron --args -n -u Administrator

如果提示密码不正确,可以试试去掉用户名

cygrunsrv -I cron -p /usr/sbin/cron --args -n

启动服务: 也可以用 windows 的启动方式 net start cron

cygrunsrv -S cron

停止服务

cygrunsrv -E cron

cron没有被使用会自动关闭(cygrunsrv: Error starting a service: QueryServiceStatus: Win32 error 1062:)

启动 cygserver(这个好像不是必需的)

cygrunsrv -I cygserver -p /usr/sbin/cygserver -e "CYGWIN=server"

$ cron-config
Cron is already installed as a service under account LocalSystem.
Do you want to remove or reinstall it? (yes/no) yes
OK. The cron service was removed.
Do you want to install the cron daemon as a service? (yes/no) yes
Enter the value of CYGWIN for the daemon: [ ] ntsec
You must decide under what account the cron daemon will run.
If you are the only user on this machine, the daemon can run as yourself.
This gives access to all network drives but only allows you as user.
To run multiple users, cron must change user context without knowing
the passwords. There are three methods to do that, as explained in
http://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-nopasswd1
If all the cron users have executed "passwd -R" (see man passwd),
which provides access to network drives, or if you are using the
cyglsa package, then cron should run under the local system account.
Otherwise you need to have or to create a privileged account.
This script will help you do so.
Do you want the cron daemon to run as yourself? (yes/no) no
Were the passwords of all cron users saved with "passwd -R", or
are you using the cyglsa package ? (yes/no) yes
The cron daemon will run as SYSTEM.
Running cron_diagnose ...
WARNING: Your computer does not appear to have a cron table for Administrator.
Please generate a cron table for Administrator using 'crontab -e'
... no problem found.
Do you want to start the cron daemon as a service now? (yes/no) yes
OK. The cron daemon is now running.
In case of problem, examine the log file for cron,
/var/log/cron.log, and the Windows event log (using /usr/bin/cronevents)
for information about the problem cron is having.
Examine also any cron.log file in the HOME directory
(or the file specified in MAILTO) and cron related files in /tmp.
If you cannot fix the problem, then report it to cygwin@cygwin.com.
Please run the script /usr/bin/cronbug and ATTACH its output
(the file cronbug.txt) to your e-mail.
WARNING: PATH may be set differently under cron than in interactive shells.
Names such as "find" and "date" may refer to Windows programs.

sync my gdrive each 10th minute

*/10 * * * * /home/Yordan/sync_gdrive.sh

# * * * * * command to be executed
# - - - - -
# | | | | |
# | | | | +- - - - day of week (0 - 6) (Sunday=0)
# | | | +- - - - - month (1 - 12)
# | | +- - - - - - day of month (1 - 31)
# | +- - - - - - - hour (0 - 23)
# +--------------- minute

来源: http://stackoverflow.com/questions/707184/how-do-you-run-a-crontab-in-cygwin-on-windows

/etc/crontab

  1. # Run scripts in cron.hourly on first minute of every hour
  2. 01 * * * * run-parts /etc/cron.hourly
  3. # Run scripts in cron.daily at 0:02 each day
  4. 02 0 * * * run-parts /etc/cron.daily
  5. #Run scripts in cron.weekly at 2:45 each Saturday
  6. 45 2 * * 6 run-parts /etc/cron.weekly
  7. #Run scripts in cron.monthly at 0:03 on the firstday of each month
  8. 03 0 1 * * run-parts /etc/cron.monthly
  9. #Run scripts in cron.yearly at 0:04 each January 1.
  10. 04 0 1 1 * run-parts /etc/cron.yearly
  11. 来源: <http://cygwin.com/ml/cygwin/2005-04/msg00751.html>

cygwin快捷方式启动

E:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注