Phpstorm Rsync



Inotify script to trigger a command on file changes, e.g. rsync

Hi there, This IDE is built around different idea - local code first, remote is secondary. This means: you work with your files locally and then upload to remote server (e.g. Manual or automatic deployment via FTP/SFTP/mounted drive/folder etc) or push to VCS (in later case this also mean that you would need to pull from VCS on remote as well). The script will probably need some tweaking for other systems, but I hope this helps others, and I really hope rsync deployment is built into PHPStorm before too long. It seems I'm not the only person missing this. Mar 08, 2021 PhpStorm controls interaction with web servers through server access configurations. Anytime you are going to use a server, you need to define a server access configuration, no matter whether your server is on a remote host or on your machine. A server access configuration defines the following: The server type (in-place, local, or remote).

watch.sh
Phpstorm Rsync
#!/bin/bash
# (c) Wolfgang Ziegler // fago
#
# Inotify script to trigger a command on file changes.
#
# The script triggers the command as soon as a file event occurs. Events
# occurring during command execution are aggregated and trigger a single command
# execution only.
#
# Usage example: Trigger rsync for synchronizing file changes.
# ./watch.sh rsync -Cra --out-format='[%t]--%n' --delete SOURCE TARGET
######### Configuration #########
EVENTS='CREATE,CLOSE_WRITE,DELETE,MODIFY,MOVED_FROM,MOVED_TO'
COMMAND='$@'
WATCHDIR=$PROJECT_DIR/web
## Exclude Git and temporary files from PHPstorm from watching.
EXCLUDE='(.git|___jb_|sites/default/dev)'
## Whether to enable verbosity. If enabled, change events are output.
VERBOSE=0
##################################
if [ -z'$1' ];then
echo'Usage: $0 Command'
exit 1;
fi
##
## Setup pipes. For usage with read we need to assign them to file descriptors.
##
RUN=$(mktemp -u)
mkfifo '$RUN'
exec3<>$RUN
RESULT=$(mktemp -u)
mkfifo '$RESULT'
exec4<>$RESULT
clean_up () {
## Cleanup pipes.
rm $RUN
rm $RESULT
}
## Execute 'clean_up' on exit.
trap'clean_up' EXIT
##
## Run inotifywait in a loop that is not blocked on command execution and ignore
## irrelevant events.
##
inotifywait -m -q -r -e $EVENTS --exclude $EXCLUDE --format '%w%f'$WATCHDIR|
whileread FILE
do
if [ $VERBOSE-ne 0 ];then
echo [CHANGE] $FILE
fi
## Clear $PID if the last command has finished.
if [ !-z'$PID' ] && ( ! ps -p $PID> /dev/null );then
PID=''
fi
## If no command is being executed, execute one.
## Else, wait for the command to finish and then execute again.
if [ -z'$PID' ];then
## Execute the following as background process.
## It runs the command once and repeats if we tell him so.
($COMMAND;whileread -t0.001 -u3 LINE;do
echo running >&4
$COMMAND
done)&
PID=$!
WAITING=0
else
## If a previous waiting command has been executed, reset the variable.
if [ $WAITING-eq 1 ] &&read -t0.001 -u4;then
WAITING=0
fi
## Tell the subprocess to execute the command again if it is not waiting
## for repeated execution already.
if [ $WAITING-eq 0 ];then
echo'run'>&3
WAITING=1
fi
## If we are already waiting, there is nothing todo.
fi
done

commented Mar 15, 2019

Phpstorm Rsync Crack

Phpstorm Rsync

commented Mar 24, 2021

Phpstorm Rsync

Works great and easy to modify. Only thing is that I get an error: line 75: read: Illegal option -t. I think it should be -t 0.001 (with an extra space)?

Phpstorm Rsync Free

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment