开发者

Eclipse Command Line Plugin

I need an Eclipse Plugin run shell scripts under Linux. I have a beautiful Rsync script and I want a button in Eclipse to activate it.

The best Solution would be if the Rsync shell script was also activated when开发者_运维知识库 I was saving Stuff, so maybe I can add a script builder or something like that.

Anyone has a clue for both of the solutions?


You could use the eclipse external tools feature. For running shell scripts put in the location field /bin/sh and the argument should be the shell script itself.

If you want to run a script when saving you can use the internal builders of Eclipse.

Project -> Properties -> Builders -> New... -> Program

Be sure you check the "After a Clean", "During auto build" options on the "Build Options" tab.


I am now using Netbeans!

The 7.0 Beta has a great included Command Line, FTP / SFTP Support with Public Keys and works great for Linux and PHP.

I was hesistant to change but now I like it even more than Eclipse. Only thing that I miss is my really fast Rsync Script, but one les thing to care about!

# !/bin/sh

#Important Notes:
# 0) Requrirements: RSYNC and SSH support on your Machine (install cygwin under windows, all good OS should already have it)
# 1) You have to configure your ssh so yout do not have to enter the Password and the Port for your Server
# 2) You have to edit the Paths and directorys to fit your Environment
# 3) You may be interested in changing some RSYNC Options
# 4) You may want to add this Script as Eclipse Builder to be run on autosave, to always keep your Server in sync.

Here is the Script if somebody wants to use it with Eclipse.

You just have to set up some environment Variables in Eclipse ($USER etc.). Worked great for me until i found Netbeans.

# Push: rsync [OPTION...] SRC... [USER@]HOST:DEST

# Useful rsync Options
# -v verbose
# -q quiet, supress non-error Messages
# -r recursive, recurse sub-directorys
# -u update, skip files that are newer on the server
# -E preserve Executability
# --chmod=CHMOD directory permissions to be set
# -z compress file data during transfer
# --compress-level NUM explicitly set compression level
# --skip-compress=LIST skip compressing files with suffix in list (for jpg, png)
# --exclude=PATTERN (for svn and eclipse config files)
# --port (maybe we want a weird port)
# -h output numbers in a human readable format (that is always good)
# --progress (may be interesting)
# --password-file read daemon-access password from file
# --bwlimit=KBPS bandwith limit
# -t transfer the modification times with the files ... makes next transfer more effective
# --delete delete files that do not exist on other side
# -C cvs-exclude - exclude RCS   SCCS   CVS   CVS.adm   RCSLOG  cvslog.*  tags  TAGS .make.state .nse_depinfo *~ #* .#* ,* _$* *$ *.old  *.bak *.BAK  *.orig *.rej .del-* *.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/ .git/ .bzr/
# --stats ... could be interesting

TARGET_HOST="www.example.com"
TARGET_DIR="/var/www/"
TARGET_USER="root"

SOURCE_DIR="/home/user/workspace/myeclipseproject/"

#Make this Variable empty if you do not want nonexisting Files on the Server to be deleted
#DELETE=" --delete"
DELETE=""

OPTIONS=" -r -u -E -z -h --progress -t --stats --chmod=a+rwx --exclude-from=exclude.txt --chmod=a+rwx "$DELETE

COMMAND="$OPTIONS  $SOURCE_DIR $TARGET_USER@$TARGET_HOST:$TARGET_DIR"
echo 'rsync '$COMMAND
rsync  $COMMAND
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜