start-stop-daemon and javaFX program - javafx

this is driving me crazy, please could you help with the start-stop-daemon to start a javafx jar file, where I need to issue the following command to start it
sudo /opt/jdk1.8.0/bin/java -Djavafx.platform=eglfb -cp /opt/jdk1.8.0/jre/lib/jfxrt.jar:/home/pi/prayertime/JavaFXApplication4.jar javafxapplication4.JavaFXApplication4 &
and the start_stop_daemon script is as follows
#!/bin/sh
#
# init script for ship-it
#
### BEGIN INIT INFO
# Provides: ship-it
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: init script for the ship-it box
# Description: We'll have to fill this out later...
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NAME=prayertime
DAEMON=/home/pi/prayertime/JavaFXApplication4.jar
DAEMONARGS="javafxapplication4.JavaFXApplication4"
PIDFILE=/var/run/$NAME.pid
LOGFILE=/var/log/$NAME.log
. /lib/lsb/init-functions
test -f $DAEMON || exit 0
case "$1" in
start)
start-stop-daemon --start --background \
--pidfile $PIDFILE --make-pidfile --startas /bin/bash \
-- -c "exec sudo /opt/jdk1.8.0/bin/java -Djavafx.platform=eglfb -cp /opt/jdk1.8.0/jre/lib/jfxrt.jar: $DAEMON $DAEMONARGS > $LOGFILE 2>&1"
log_end_msg $?
;;

Related

Unix shell - syntax error near unexpected token `done'

Below is my code.
#!/bin/ksh
curdate=$(date '+%d%h,%Y')
while read line;
do
echo "$line" > new10.txt
str0=$(cut -f 2 new10.txt)
str01=$(cut -f 1 -d ',' new10.txt)
str1=$(cut -f 2 -d ',' new10.txt)
str2=$(cut -c 3 $str1)
if [ $str2=':' ];
then
str2=',2016'
finalstr=$str01$str2
if [ '01jan2017' -le $finalstr -le $curdate ];
then
finalstr1=$str01',2017'
else
finalstr1=$str01',2016'
echo $finalstr1 > datefinal.txt
fi
done < /export/home/islams/PISAS/userwiseutil/date.txt
I am getting following errors:
date1.sh: line 22: syntax error near unexpected token done'
date1.sh: line 22:done < /export/home/islams/PISAS/userwiseutil/date.txt'
#!/bin/ksh
curdate=$(date '+%d%h,%Y')
while read line;
do
echo "$line" > new10.txt
str0=$(cut -f 2 new10.txt)
str01=$(cut -f 1 -d ',' new10.txt)
str1=$(cut -f 2 -d ',' new10.txt)
str2=$(cut -c 3 $str1)
if [ $str2=':' ];
then
str2=',2016'
finalstr=$str01$str2
if [ '01jan2017' -le $finalstr -le $curdate ];
then
finalstr1=$str01',2017'
else
finalstr1=$str01',2016'
echo $finalstr1 > datefinal.txt
fi
fi #You missed this
done < /export/home/islams/PISAS/userwiseutil/date.txt
You missed one fi

puma recipe failing on CentOS

I'm trying create a chef-solo recipe for using puma on centos6. All of the guides that I see are targeted towards Ubuntu using Upstart. I've tried making modifications to use init but it still fails with the error * /etc/init.d/puma-manager does not exist!.
/recipes/puma.rb
# add puma init conf
template '/etc/init/puma.conf' do
source 'puma-init.conf.erb'
mode 0644
end
# add puma manager conf
template '/etc/init/puma-manager.conf' do
source 'puma-manager.conf.erb'
mode 0644
end
# add puma conf
template '/etc/puma.conf' do
source 'puma.conf.erb'
mode 0644
end
cookbook_file '/etc/init.d/puma' do
source 'puma'
owner 'deploy'
group 'deploy'
mode '0755'
action :create
end
cookbook_file '/usr/local/bin/run-puma' do
source 'run-puma'
owner 'deploy'
group 'deploy'
mode '0755'
action :create
end
# add puma app conf
template "#{node['app_shared_path']}/config/puma.rb" do
source 'puma.rb.erb'
mode 0644
# notifies :restart, 'service[puma]', :delayed
end
service 'puma-manager' do
provider Chef::Provider::Service::Init
supports ['start', 'stop', 'restart', 'status']
action :start
end
/files/default/puma
#! /bin/sh
### BEGIN INIT INFO
# Provides: puma
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
### END INIT INFO
# Author: Darío Javier Cravero <dario#exordo.com>
#
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/local/bin:/usr/local/sbin/:/sbin:/usr/sbin:/bin:/usr/bin
DESC="Puma rack web server"
NAME=puma
DAEMON=$NAME
SCRIPTNAME=/etc/init.d/$NAME
CONFIG=/etc/puma.conf
JUNGLE=`cat $CONFIG`
RUNPUMA=/usr/local/bin/run-puma
USE_LOCAL_BUNDLE=0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the jungle
#
do_start() {
log_daemon_msg "=> Running the jungle..."
for i in $JUNGLE; do
dir=`echo $i | cut -d , -f 1`
user=`echo $i | cut -d , -f 2`
config_file=`echo $i | cut -d , -f 3`
if [ "$config_file" = "" ]; then
config_file="$dir/config/puma.rb"
fi
log_file=`echo $i | cut -d , -f 4`
if [ "$log_file" = "" ]; then
log_file="$dir/log/puma.log"
fi
environment=`echo $i | cut -d , -f 5`
do_start_one $dir $user $config_file $log_file $environment
done
}
do_start_one() {
PIDFILE=$1/tmp/puma/pid
if [ -e $PIDFILE ]; then
PID=`cat $PIDFILE`
# If the puma isn't running, run it, otherwise restart it.
if [ "`ps -A -o pid= | grep -c $PID`" -eq 0 ]; then
do_start_one_do $1 $2 $3 $4 $5
else
do_restart_one $1
fi
else
do_start_one_do $1 $2 $3 $4 $5
fi
}
do_start_one_do() {
log_daemon_msg "--> Woke up puma $1"
log_daemon_msg "user $2"
log_daemon_msg "log to $4"
if [ ! -z "$5" ]; then
for e in $(echo "$5" | tr ';' '\n'); do
log_daemon_msg "environment $e"
v=${e%%\=*} ; eval "$e" ; export $v
done
fi
start-stop-daemon --verbose --start --chdir $1 --chuid $2 --background --exec $RUNPUMA -- $1 $3 $4
}
#
# Function that stops the jungle
#
do_stop() {
log_daemon_msg "=> Putting all the beasts to bed..."
for i in $JUNGLE; do
dir=`echo $i | cut -d , -f 1`
do_stop_one $dir
done
}
#
# Function that stops the daemon/service
#
do_stop_one() {
log_daemon_msg "--> Stopping $1"
PIDFILE=$1/tmp/puma/pid
STATEFILE=$1/tmp/puma/state
if [ -e $PIDFILE ]; then
PID=`cat $PIDFILE`
if [ "`ps -A -o pid= | grep -c $PID`" -eq 0 ]; then
log_daemon_msg "---> Puma $1 isn't running."
else
log_daemon_msg "---> About to kill PID `cat $PIDFILE`"
if [ "$USE_LOCAL_BUNDLE" -eq 1 ]; then
cd $1 && bundle exec pumactl --state $STATEFILE stop
else
pumactl --state $STATEFILE stop
fi
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE $STATEFILE
fi
else
log_daemon_msg "---> No puma here..."
fi
return 0
}
#
# Function that restarts the jungle
#
do_restart() {
for i in $JUNGLE; do
dir=`echo $i | cut -d , -f 1`
do_restart_one $dir
done
}
#
# Function that sends a SIGUSR2 to the daemon/service
#
do_restart_one() {
PIDFILE=$1/tmp/puma/pid
i=`grep $1 $CONFIG`
dir=`echo $i | cut -d , -f 1`
if [ -e $PIDFILE ]; then
log_daemon_msg "--> About to restart puma $1"
if [ "$USE_LOCAL_BUNDLE" -eq 1 ]; then
cd $1 && bundle exec pumactl --state $dir/tmp/puma/state restart
else
pumactl --state $dir/tmp/puma/state restart
fi
# kill -s USR2 `cat $PIDFILE`
# TODO Check if process exist
else
log_daemon_msg "--> Your puma was never playing... Let's get it out there first"
user=`echo $i | cut -d , -f 2`
config_file=`echo $i | cut -d , -f 3`
if [ "$config_file" = "" ]; then
config_file="$dir/config/puma.rb"
fi
log_file=`echo $i | cut -d , -f 4`
if [ "$log_file" = "" ]; then
log_file="$dir/log/puma.log"
fi
environment=`echo $i | cut -d , -f 5`
do_start_one $dir $user $config_file $log_file $environment
fi
return 0
}
#
# Function that statuss the jungle
#
do_status() {
for i in $JUNGLE; do
dir=`echo $i | cut -d , -f 1`
do_status_one $dir
done
}
#
# Function that sends a SIGUSR2 to the daemon/service
#
do_status_one() {
PIDFILE=$1/tmp/puma/pid
i=`grep $1 $CONFIG`
dir=`echo $i | cut -d , -f 1`
if [ -e $PIDFILE ]; then
log_daemon_msg "--> About to status puma $1"
if [ "$USE_LOCAL_BUNDLE" -eq 1 ]; then
cd $1 && bundle exec pumactl --state $dir/tmp/puma/state stats
else
pumactl --state $dir/tmp/puma/state stats
fi
# kill -s USR2 `cat $PIDFILE`
# TODO Check if process exist
else
log_daemon_msg "--> $1 isn't there :(..."
fi
return 0
}
do_add() {
str=""
# App's directory
if [ -d "$1" ]; then
if [ "`grep -c "^$1" $CONFIG`" -eq 0 ]; then
str=$1
else
echo "The app is already being managed. Remove it if you want to update its config."
exit 1
fi
else
echo "The directory $1 doesn't exist."
exit 1
fi
# User to run it as
if [ "`grep -c "^$2:" /etc/passwd`" -eq 0 ]; then
echo "The user $2 doesn't exist."
exit 1
else
str="$str,$2"
fi
# Config file
if [ "$3" != "" ]; then
if [ -e $3 ]; then
str="$str,$3"
else
echo "The config file $3 doesn't exist."
exit 1
fi
fi
# Log file
if [ "$4" != "" ]; then
str="$str,$4"
fi
# Environment variables
if [ "$5" != "" ]; then
str="$str,$5"
fi
# Add it to the jungle
echo $str >> $CONFIG
log_daemon_msg "Added a Puma to the jungle: $str. You still have to start it though."
}
do_remove() {
if [ "`grep -c "^$1" $CONFIG`" -eq 0 ]; then
echo "There's no app $1 to remove."
else
# Stop it first.
do_stop_one $1
# Remove it from the config.
sed -i "\\:^$1:d" $CONFIG
log_daemon_msg "Removed a Puma from the jungle: $1."
fi
}
config_bundler() {
HOME="$(eval echo ~$(id -un))"
if [ -d "/usr/local/rbenv/bin" ]; then
PATH="/usr/local/rbenv/bin:/usr/local/rbenv/shims:$PATH"
eval "$(rbenv init -)"
USE_LOCAL_BUNDLE=1
return 0
elif [ -d "$HOME/.rbenv/bin" ]; then
PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
eval "$(rbenv init -)"
USE_LOCAL_BUNDLE=1
return 0
# TODO: test rvm
# elif [ -f /etc/profile.d/rvm.sh ]; then
# source /etc/profile.d/rvm.sh
# elif [ -f /usr/local/rvm/scripts/rvm ]; then
# source /etc/profile.d/rvm.sh
# elif [ -f "$HOME/.rvm/scripts/rvm" ]; then
# source "$HOME/.rvm/scripts/rvm"
# TODO: don't know what to do with chruby
# elif [ -f /usr/local/share/chruby/chruby.sh ]; then
# source /usr/local/share/chruby/chruby.sh
# if [ -f /usr/local/share/chruby/auto.sh ]; then
# source /usr/local/share/chruby/auto.sh
# fi
# if you aren't using auto, set your version here
# chruby 2.0.0
fi
return 1
}
config_bundler
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
if [ "$#" -eq 1 ]; then
do_start
else
i=`grep $2 $CONFIG`
dir=`echo $i | cut -d , -f 1`
user=`echo $i | cut -d , -f 2`
config_file=`echo $i | cut -d , -f 3`
if [ "$config_file" = "" ]; then
config_file="$dir/config/puma.rb"
fi
log_file=`echo $i | cut -d , -f 4`
if [ "$log_file" = "" ]; then
log_file="$dir/log/puma.log"
fi
do_start_one $dir $user $config_file $log_file
fi
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
if [ "$#" -eq 1 ]; then
do_stop
else
i=`grep $2 $CONFIG`
dir=`echo $i | cut -d , -f 1`
do_stop_one $dir
fi
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
# TODO Implement.
log_daemon_msg "Status $DESC" "$NAME"
if [ "$#" -eq 1 ]; then
do_status
else
i=`grep $2 $CONFIG`
dir=`echo $i | cut -d , -f 1`
do_status_one $dir
fi
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
if [ "$#" -eq 1 ]; then
do_restart
else
i=`grep $2 $CONFIG`
dir=`echo $i | cut -d , -f 1`
do_restart_one $dir
fi
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
add)
if [ "$#" -lt 3 ]; then
echo "Please, specifiy the app's directory and the user that will run it at least."
echo " Usage: $SCRIPTNAME add /path/to/app user /path/to/app/config/puma.rb /path/to/app/config/log/puma.log"
echo " config and log are optionals."
exit 1
else
do_add $2 $3 $4 $5
fi
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
remove)
if [ "$#" -lt 2 ]; then
echo "Please, specifiy the app's directory to remove."
exit 1
else
do_remove $2
fi
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
*)
echo "Usage:" >&2
echo " Run the jungle: $SCRIPTNAME {start|stop|status|restart}" >&2
echo " Add a Puma: $SCRIPTNAME add /path/to/app user /path/to/app/config/puma.rb /path/to/app/config/log/puma.log"
echo " config and log are optionals."
echo " Remove a Puma: $SCRIPTNAME remove /path/to/app"
echo " On a Puma: $SCRIPTNAME {start|stop|status|restart} PUMA-NAME" >&2
exit 3
;;
esac
:
/files/default/run-puma
#!/bin/bash
app=$1; config=$2; log=$3;
cd $app && exec bundle exec puma -C $config 2>&1 >> $log
First of all, your service name seems to be wrong. It seems like it should be called service 'puma' instead of puma-manager.
Besides that, a init script from Debian/Ubuntu will not work on CentOS without modifications. Some required files like the helper methods from the init-functions do not exist on CentOS.
Depending on the script, those modification can be quite complex and sometimes it's better to write a new script from scratch.
Anyway, there is a non-official CentOS init script example for Puma here:
https://github.com/puma/puma/issues/178
But it is a little old/untested and I'm not sure it will work without modification.

unix ftp script to get latest file from server

I have a unix script to get files via ftp looks something like this:
#!/bin/sh
HOST='1.1.1.1'
USER='user'
PASSWD='pass'
FILE='1234'
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd .LogbookPlus
get $FILE
quit
END_SCRIPT
exit 0
Instead of getting a specific file, I want to get the last modified file in a folder, or all files created in the last 24 hours. Is this possible via ftp?
This is really pushing the FTP client further than it should be pushed, but it is possible.
Note that the LS_FILE_OFFSET might be different on your system and this won't work at all if the offset is wrong.
#!/bin/sh
HOST='1.1.1.1'
USER='user'
PASSWD='pass'
DIRECTORY='.LogbookPlus'
FILES_TO_GET=1
LS_FILE_OFFSET=57 # Check directory_listing to see where filename begins
rm -f directory_listing
# get listing from directory sorted by modification date
ftp -n $HOST > directory_listing <<fin
quote USER $USER
quote PASS $PASSWD
cd $DIRECTORY
ls -t
quit
fin
# parse the filenames from the directory listing
files_to_get=`cut -c $LS_FILE_OFFSET- < directory_listing | head -$FILES_TO_GET`
# make a set of get commands from the filename(s)
cmd=""
for f in $files_to_get; do
cmd="${cmd}get $f
"
done
# go back and get the file(s)
ftp -n $HOST <<fin
quote USER $USER
quote PASS $PASSWD
cd $DIRECTORY
$cmd
quit
fin
exit 0
You should have definitely given some more information about the systems you are using, e.g. not every ftp server supports ls -t that #JesseParker uses. I used the opportunity and put some ideas that I have used myself for some time into a script that uses awk to to the dirty deeds. As you can see, knowing what flavor of unix your client uses would be beneficial. I have tested this script to run under Debian Wheezy GNU/Linux and FreeBSD 9.2.
#!/bin/sh
# usage: <this_script> <num_files> <date...> [ <...of...> <...max....> <...age...> ... ]
#
# Fetches files from preconfigured ftp server to current directory.
# Maximum number of files is <num_files>
# Only files that have a newer modification time than given date are considered.
# This date is given according to the local 'date' command, which is very different
# on BSD and GNU systems, e.g.:
#
# GNU:
# yesterday
# last year
# Jan 01 1970
#
# BSD:
# -v-1d # yesterday (now minus 1 day)
# -v-1y # last year (now minus 1 year)
# -f %b %e %C%y Jan 01 1970 # format: month day century year
#
# Script tries to autodetect date system, YMMV.
#
# BUGS:
# Does not like quotation marks (") in file names, maybe much more.
#
# Should not have credentials inside this file, but maybe have them
# in '.netrc' and not use 'ftp -n'.
#
# Plenty more.
#
HOST='1.1.1.1'
USER='user'
PASSWD='pass'
DIR='.LogbookPlus'
# Date format for numerical comparison. Can be simply +%s if supported.
DATE_FMT=+%C%y%m%d%H%M%S
# The server's locale for date strings.
LC_SRV_DATE=C
# The 'date' command from BSD systems and that from the GNU coreutils
# are completely different. Test for the appropriate system here:
if LC_ALL=C date -j -f "%b %e %C%y" "Jan 01 1970" $DATE_FMT > /dev/null 2>&1 ; then
SYS_TYPE=BSDish
elif LC_ALL=C date -d "Jan 01 1970" $DATE_FMT > /dev/null 2>&1 ; then
SYS_TYPE=GNUish
else
echo "sh: don't know how to date ;-) sorry!"
exit 1;
fi
# Max. number of files to get (newest files first)
MAX_NUM=$(( ${1:-1} + 0 )) # ensure argv[1] is treated as a number
shift
# Max. age of files. Only files newer that this will be considered.
if [ GNUish = "$SYS_TYPE" ] ; then
MAX_AGE=$( date "$DATE_FMT" -d "${*:-yesterday}" )
elif [ BSDish = "$SYS_TYPE" ] ; then
MAX_AGE=$( date -j "${*:--v-1d}" "$DATE_FMT" )
fi
# create temporary file
TMP_FILE=$(mktemp)
trap 'rm -f "$TMP_FILE"' EXIT INT TERM HUP
ftp -i -n $HOST <<END_FTP_SCRIPT | \
awk -v max_age="$MAX_AGE" \
-v max_num="$MAX_NUM" \
-v date_fmt="$DATE_FMT" \
-v date_loc="$LC_SRV_DATE" \
-v sys_type="$SYS_TYPE" \
-v tmp_file="$TMP_FILE" '
BEGIN {
# columns in the 'dir' output from the ftp server:
# drwx------ 1 user group 4096 Apr 8 2009 Mail
# -rw------- 1 user group 13052 Nov 20 02:07 .bash_history
perm=1; links=2; user=3; group=4; size=5; month=6; day=7; yeartime=8; # name=$9..$NF
if ( "BSDish" == sys_type ) {
date_cmd="LC_ALL=" date_loc " date -j -f"
} else if ( "GNUish" == sys_type ) {
date_cmd="LC_ALL=" date_loc " date -d"
} else {
print "awk: don'\''t know how to date ;-) sorry!" > "/dev/stderr"
exit 1;
}
files[""] = ""
file_cnt = 0
out_cmd = "sort -rn | head -n " max_num " > " tmp_file
}
$perm ~ /^[^-]/ { # skip non-regular files
next
}
{
if ( "BSDish" == sys_type ) {
if ( $yeartime ~ /[0-9][0-9][0-9][0-9]/ ) {
ts_fmt = "\"%b %e %C%y\""
} else if ( $yeartime ~ /[0-9][0-9:[0-9][0-9]/ ) {
ts_fmt = "\"%b %e %H:%M\""
} else {
print "has neither year nor time: " $8
exit 1
}
} else { # tested in BEGIN: must be "GNUish"
ts_fmt = ""
}
cmd = date_cmd " " ts_fmt " \"" $month " " $day " " $yeartime "\" " date_fmt
cmd | getline timestamp
close( cmd )
if ( timestamp > max_age ) {
# clear everything but the file name
$perm=$links=$user=$group=$size=$month=$day=$yeartime=""
files[ file_cnt,"name" ] = $0
files[ file_cnt,"time" ] = timestamp
++file_cnt
}
}
END {
for( i=0; i<file_cnt; ++i ) {
print files[ i,"time" ] "\t" files[ i,"name" ] \
| out_cmd
}
close( out_cmd )
print "quote USER '$USER'\nquote PASS '$PASSWD'\ncd \"'$DIR'\""
i = 0
while( (getline < tmp_file) > 0 ) {
$1 = "" # drop timestamp
gsub( /^ /,"" ) # strip leading space
print "get \"" $0 "\""
}
print "quit"
}
' \
| ftp -v -i -n $HOST
quote USER $USER
quote PASS $PASSWD
cd "$DIR"
dir .
quit
END_FTP_SCRIPT

How to get play! framework running in MSYS bash

I can’t use play! framework from a MSYS shell (as used in Git on Windows).
Error during sbt execution: Could not find configuration file
'c:/Dev/Prg/Play/framework/sbt/play.boot.properties'. Searched:
file:/C:/Users/Paul/
file:/C:/Users/Paul/
file:/C:/Dev/Prg/Play/framework/sbt/
Is there a way to get this running?
A solution to this problem has been posted on the Play mailing list: There’s a patch that solves the problem.
diff -r --unified play-2.0-orig/framework/build play-2.0-cygwin/framework/build
--- play-2.0-orig/framework/build 2012-03-12 20:25:28.000000000 -0700
+++ play-2.0-cygwin/framework/build 2012-06-15 17:56:57.436000000 -0700
## -8,4 +8,4 ##
DEBUG_PARAM="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${JPDA_PORT}"
fi
-java ${DEBUG_PARAM} -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -Dfile.encoding=UTF8 -Dplay.version="${PLAY_VERSION}" -Dsbt.ivy.home=`dirname $0`/../repository -Dplay.home=`dirname $0` -Dsbt.boot.properties=`dirname $0`/sbt/sbt.boot.properties -jar `dirname $0`/sbt/sbt-launch.jar "$#"
\ No newline at end of file
+java ${DEBUG_PARAM} -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -Dfile.encoding=UTF8 -Dplay.version="${PLAY_VERSION}" -Dsbt.ivy.home=`dirname $0`/../repository -Dplay.home=`dirname $0` -Dsbt.boot.properties=$BOOTPROP`dirname $0`/sbt/sbt.boot.properties -jar `dirname $0`/sbt/sbt-launch.jar "$#"
diff -r --unified play-2.0-orig/play play-2.0-cygwin/play
--- play-2.0-orig/play 2012-03-12 20:22:03.000000000 -0700
+++ play-2.0-cygwin/play 2012-06-15 20:48:41.624800000 -0700
## -1,5 +1,23 ##
#! /usr/bin/env sh
+case `uname` in
+ CYGWIN*)
+ function dirname {
+ cygpath -m `command dirname $#`
+ }
+ typeset -fx dirname
+ export BOOTPROP="file:///"
+ ;;
+ MINGW32*)
+ function dirname { (cd `command dirname $#`; pwd -W) }
+ typeset -fx dirname
+ export BOOTPROP="file:///"
+ ;;
+ *)
+ export BOOTPROP=""
+ ;;
+esac
+
PRG="$0"
while [ -h "$PRG" ] ; do
PRG=`readlink "$PRG"`
## -54,5 +72,5 ##
fi
else
- java -Dsbt.ivy.home=$dir/repository -Dplay.home=$dir/framework -Dsbt.boot.properties=$dir/framework/sbt/play.boot.properties -jar $dir/framework/sbt/sbt-launch.jar "$#"
+ java -Dsbt.ivy.home=$dir/repository -Dplay.home=$dir/framework -Dsbt.boot.properties=$BOOTPROP$dir/framework/sbt/play.boot.properties -jar $dir/framework/sbt/sbt-launch.jar "$#"
fi
A solution for play-2.1.3.
start mingw32
cd /path/to/play-2.1.3
patch -p1 < /path/to/play_cygwin.patch
Copy of this patch:
diff -r --unified play-2.1.3/framework/build play-2.1.3-cygwin/framework/build
--- play-2.1.3/framework/build 2013-08-06 12:29:56 +0000
+++ play-2.1.3-cygwin/framework/build 2013-09-04 13:44:05 +0000
## -10,4 +10,4 ##
DEBUG_PARAM="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${JPDA_PORT}"
fi
-java ${DEBUG_PARAM} -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M ${JAVA_OPTS} -Dfile.encoding=UTF-8 -Dplay.version="${PLAY_VERSION}" -Dsbt.ivy.home=`dirname $0`/../repository -Dplay.home=`dirname $0` -Dsbt.boot.properties=`dirname $0`/sbt/sbt.boot.properties -jar `dirname $0`/sbt/sbt-launch.jar "$#"
+java ${DEBUG_PARAM} -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M ${JAVA_OPTS} -Dfile.encoding=UTF-8 -Dplay.version="${PLAY_VERSION}" -Dsbt.ivy.home=`dirname $0`/../repository -Dplay.home=`dirname $0` -Dsbt.boot.properties=$BOOTPROP`dirname $0`/sbt/sbt.boot.properties -jar `dirname $0`/sbt/sbt-launch.jar "$#"
diff -r --unified play-2.1.3/play play-2.1.3-cygwin/play
--- play-2.1.3/play 2013-09-04 02:44:05 +0000
+++ play-2.1.3-cygwin/play 2013-09-04 13:51:36 +0000
## -1,5 +1,23 ##
#! /usr/bin/env sh
+case `uname` in
+ CYGWIN*)
+ function dirname {
+ cygpath -m `command dirname $#`
+ }
+ typeset -fx dirname
+ export BOOTPROP="file:///"
+ ;;
+ MINGW32*)
+ function dirname { (cd `command dirname $#`; pwd -W) }
+ typeset -fx dirname
+ export BOOTPROP="file:///"
+ ;;
+ *)
+ export BOOTPROP=""
+ ;;
+esac
+
PRG="$0"
while [ -h "$PRG" ] ; do
PRG=`readlink "$PRG"`
## -61,5 +79,5 ##
fi
else
- "$JAVA" -Dsbt.ivy.home=$dir/repository -Dplay.home=$dir/framework -Dsbt.boot.properties=$dir/framework/sbt/play.boot.properties -jar $dir/framework/sbt/sbt-launch.jar "$#"
+ "$JAVA" -Dsbt.ivy.home=$dir/repository -Dplay.home=$dir/framework -Dsbt.boot.properties=$BOOTPROP$dir/framework/sbt/play.boot.properties -jar $dir/framework/sbt/sbt-launch.jar "$#"
fi
I faced the same problem.
In my case the problem occurred because of having space in directory name. I renamed one of my folder that contained space in it's name and my problem was solved.

saving stdout, stderr and both into 3 separate files

I am using ksh. On this link http://www.shelldorado.com/shelltips/advanced.html#redir , there is an example for saving stdout, stderr and both into 3 separate files.
((./program 2>&1 1>&3 | tee ~/err.txt) 3>&1 1>&2 | tee ~/out.txt) > ~/mix.txt 2>&1
I tried that but I am getting below error:
ksh: syntax error: `(' unexpected
Please advice.
Pretty much works for me:
$ ksh
$ ps | grep "$$"
6987 pts/6 00:00:00 ksh
$ cat program.sh
#!/bin/sh
echo "err" 1>&2
echo "out"
$ ((./program.sh 2>&1 1>&3 | tee err.txt) 3>&1 1>&2 | tee out.txt) > mix.txt 2>&1
$ cat out.txt
out
$ cat err.txt
err
$ cat mix.txt
err
out

Resources