Skip to content
Snippets Groups Projects
Commit aa1f2c5b authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

trying to make upload.daemon more robust

parent c7bc27c4
No related branches found
No related tags found
No related merge requests found
......@@ -240,7 +240,7 @@ background_wid=$(xwininfo -root -children | grep "$background_pattern" | awk '{
xdotool set_window --name "Controlled by PULT" "$background_wid"
while true; do
nc.openbsd -q 0 -w 10 -l "$pultd_port" | \
nc.openbsd -q 0 -l "$pultd_port" | \
while read -ra cmd; do
m="${cmd[0]}"
$debug && echo -e "$0: command = \"${cmd[*]}\"" 1>&2
......
......@@ -22,6 +22,7 @@ pointer_windowid=""
cleanup ()
{
rm -rf "$b64_filename" "$lock_filename"
if [ -n "$(jobs -p)" ]; then
kill $(jobs -p)
fi
......@@ -31,8 +32,7 @@ trap cleanup exit;
shopt -s lastpipe
while true; do
nc.openbsd -w 10 -l "$module_daemon_port" | \
nc.openbsd -l "$module_daemon_port" | \
while read cmd param_x param_y; do
echo "cmd = $cmd, param_x = $param_x, param_y = $param_y"
if [ "$cmd" = "pointer" ]; then
......@@ -73,5 +73,3 @@ while true; do
echo "... done."
fi
done
sleep 1s
done
......@@ -31,7 +31,7 @@ img_title="$module_name Image Viewer"
cmd="$1"
case "$cmd" in
start)
rm -rf "$pid_file" "$config_file" "$upload_dir/$filename" "$upload_dir/$error_filename" "$www_dir$download_dir/$filename"
rm -rf "$pid_file" "$config_file" "$upload_dir/$filename" "$upload_dir/$error_filename" "$upload_dir/$lock_filename" "$www_dir$download_dir/$filename"
touch "$config_file"
echo -e "\$pultd_port = $pultd_port;" >> "$config_file"
echo -e "\$module_name = \"$module_name\";" >> "$config_file"
......@@ -49,12 +49,12 @@ case "$cmd" in
sleep 1
echo -e "$0[$channel]: ... okay, let's hope."
fi
echo websockify "$module_daemon_port" -- "$daemon" "$module_name" "$channel" \
echo websockify "$module_daemon_port" --wrap-mode=respawn -- "$daemon" "$module_name" "$channel" \
"$module_daemon_port" "$img_title" \
"$www_dir/$pointer_filename" \
"$upload_dir/$b64_filename" "$upload_dir/$lock_filename" \
"$upload_dir/$filename"
websockify "$module_daemon_port" -- "$daemon" "$module_name" "$channel" \
websockify "$module_daemon_port" --wrap-mode=respawn -- "$daemon" "$module_name" "$channel" \
"$module_daemon_port" "$img_title" \
"$www_dir/$pointer_filename" \
"$upload_dir/$b64_filename" "$upload_dir/$lock_filename" \
......@@ -77,7 +77,7 @@ case "$cmd" in
else
echo -e "$0[$channel]: stop: not running"
fi
rm -rf "$upload_dir/$filename" "$upload_dir/$error_filename" "$www_dir$download_dir/$filename"
rm -rf "$pid_file" "$config_file" "$upload_dir/$filename" "$upload_dir/$error_filename" "$upload_dir/$lock_filename" "$www_dir$download_dir/$filename"
;;
defaults)
echo "min=false"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment